agora inbox for [email protected]
help / color / mirror / Atom feedName of main process differs between servers (postmaster vs postgres)
969+ messages / 4 participants
[nested] [flat]
* Name of main process differs between servers (postmaster vs postgres)
@ 2018-06-26 21:51 Jonathan Lemig <[email protected]>
2018-06-26 22:02 ` Re: Name of main process differs between servers (postmaster vs postgres) Justin Pryzby <[email protected]>
2018-06-26 22:04 ` Re: Name of main process differs between servers (postmaster vs postgres) David G. Johnston <[email protected]>
0 siblings, 2 replies; 969+ messages in thread
From: Jonathan Lemig @ 2018-06-26 21:51 UTC (permalink / raw)
To: pgsql-hackers
--0000000000005bcfc4056f92808b
Content-Type: text/plain; charset="UTF-8"
Hi,
I noticed on two of my postgres servers, one has "postmaster" for the main
process, and the other has "postgres". My question is - why is this? For
example:
Server1:
postgres 909 1 0 May08 ? 00:03:55
/usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/
Server2:
postgres 4804 1 0 May01 ? 00:05:08 /usr/pgsql-9.6/bin/postgres
-D /var/lib/pgsql/9.6/data
Both servers are running CentOS Linux release 7.4.1708 for the OS
and PostgreSQL 9.6.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-16), 64-bit.
The only differences I've been able to find so far are:
1) When doing a ps, server1 shows a trailing slash for the $PGDATA
directory whereas server2 doesn't have the trailing slash. I echoed $PGDATA
on both servers and they're both the same (no trailing slash).
2) Server2 has an additional package installed
-- postgresql96-contrib-9.6.8-1PGDG.rhel7.x86_64. Aside from that, both
servers have the same packages installed:
postgresql96-9.6.8-1PGDG.rhel7.x86_64
postgresql96-server-9.6.8-1PGDG.rhel7.x86_64
postgresql96-libs-9.6.8-1PGDG.rhel7.x86_64
postgresql96-pglogical-2.2.0-1.el7.x86_64
Looking at the documentation, it seems that postmaster is a deprecated
alias for the postgres process so while they differ in name, they're the
same in spirit?
^ permalink raw reply [nested|flat] 969+ messages in thread
* Re: Name of main process differs between servers (postmaster vs postgres)
2018-06-26 21:51 Name of main process differs between servers (postmaster vs postgres) Jonathan Lemig <[email protected]>
@ 2018-06-26 22:02 ` Justin Pryzby <[email protected]>
1 sibling, 0 replies; 969+ messages in thread
From: Justin Pryzby @ 2018-06-26 22:02 UTC (permalink / raw)
To: Jonathan Lemig <[email protected]>; +Cc: pgsql-hackers
On Tue, Jun 26, 2018 at 04:51:32PM -0500, Jonathan Lemig wrote:
> Hi,
>
> I noticed on two of my postgres servers, one has "postmaster" for the main
> process, and the other has "postgres". My question is - why is this? For
> example:
On my centos6 servers:
151814 0 lrwxrwxrwx 1 root root 8 May 10 21:32 /usr/pgsql-10/bin/postmaster -> postgres
Do you have something else ?
Is there a symlink for pg_ctl or postmaster or postgres in /s?bin, /usr/s?bin,
or /usr/local/s?bin ?
Was one started by initscript and one started by something else (manually
running pg_ctl or similar) ?
Are the initscripts the same?
Did one of them start at boot and one restarted since then ?
You might get a hint by comparing /proc/909/environ with /proc/4804/environ
(the relative pids suggests that 4804 was perhaps re/started significantly
after boot). And or proc/pid/comm, exe and stat.
Did one of them crash since it was started (or killed by OOM) ?
Justin
PS, I think the list residents would for the future to ask to keep admin/DBA
oriented questions on pgsql-general, and development/bugs on -hackers.
^ permalink raw reply [nested|flat] 969+ messages in thread
* Re: Name of main process differs between servers (postmaster vs postgres)
2018-06-26 21:51 Name of main process differs between servers (postmaster vs postgres) Jonathan Lemig <[email protected]>
@ 2018-06-26 22:04 ` David G. Johnston <[email protected]>
2018-06-27 14:09 ` Re: Name of main process differs between servers (postmaster vs postgres) Jonathan Lemig <[email protected]>
1 sibling, 1 reply; 969+ messages in thread
From: David G. Johnston @ 2018-06-26 22:04 UTC (permalink / raw)
To: Jonathan Lemig <[email protected]>; +Cc: pgsql-hackers
On Tue, Jun 26, 2018 at 2:51 PM, Jonathan Lemig <[email protected]> wrote:
> From what I can tell, things are running fine on both servers, I guess I
> just don't like there is a difference/inconsistency. Can anyone please
> explain this?
>
>
Best guess, one of the servers has upgrades from previous versions applied
to it while the other started with a newer release. The upgraded server
didn't mess with a pre-existing launch script that was using postmaster
while the new one made use of the likely newer script that calls postgres.
Dave
^ permalink raw reply [nested|flat] 969+ messages in thread
* Re: Name of main process differs between servers (postmaster vs postgres)
2018-06-26 21:51 Name of main process differs between servers (postmaster vs postgres) Jonathan Lemig <[email protected]>
2018-06-26 22:04 ` Re: Name of main process differs between servers (postmaster vs postgres) David G. Johnston <[email protected]>
@ 2018-06-27 14:09 ` Jonathan Lemig <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Jonathan Lemig @ 2018-06-27 14:09 UTC (permalink / raw)
To: David G. Johnston <[email protected]>; +Cc: pgsql-hackers
>
> Best guess, one of the servers has upgrades from previous versions
> applied to it while the other started with a newer release. The upgraded
> server didn't mess with a pre-existing launch script that was using
> postmaster while the new one made use of the likely newer script that calls
> postgres.
>
I bet it does have something to do with that. I had to migrate one of our
Postgres server from Fedora Core 24/Postgres 9.5 to CentOS 7/Postgres 9.6.
I'm new to Postgres and was playing around with different methods and
settled on using pglogical. I refined (that's being generous) the
migration process and migrated DEV and then PROD. Perhaps I should have had
our SA re-do the VMs after the refinements, but before doing the final
migrations, to make sure everything was apples-to-apples.
Thanks!
Jon
On Tue, Jun 26, 2018 at 5:04 PM, David G. Johnston <
[email protected]> wrote:
> On Tue, Jun 26, 2018 at 2:51 PM, Jonathan Lemig <[email protected]> wrote:
>
>> From what I can tell, things are running fine on both servers, I guess I
>> just don't like there is a difference/inconsistency. Can anyone please
>> explain this?
>>
>>
> Best guess, one of the servers has upgrades from previous versions
> applied to it while the other started with a newer release. The upgraded
> server didn't mess with a pre-existing launch script that was using
> postmaster while the new one made use of the likely newer script that calls
> postgres.
>
> Dave
>
>
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
* [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests
@ 2026-04-22 09:22 Álvaro Herrera <[email protected]>
0 siblings, 0 replies; 969+ messages in thread
From: Álvaro Herrera @ 2026-04-22 09:22 UTC (permalink / raw)
These tests sometimes run with wal_level=minimal, which does not allow
to run REPACK (CONCURRENTLY). Move them to test_decoding, which is
ensured to run with high enough wal_level.
Discussion: https://postgr.es/m/[email protected]
---
contrib/test_decoding/Makefile | 2 +-
contrib/test_decoding/expected/repack.out | 30 +++++++++++++++++++++++
contrib/test_decoding/meson.build | 1 +
contrib/test_decoding/sql/repack.sql | 25 +++++++++++++++++++
src/test/regress/expected/cluster.out | 29 +++-------------------
src/test/regress/sql/cluster.sql | 13 +++-------
6 files changed, 65 insertions(+), 35 deletions(-)
create mode 100644 contrib/test_decoding/expected/repack.out
create mode 100644 contrib/test_decoding/sql/repack.sql
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index acbcaed2feb..0111124399a 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
- spill slot truncate stream stats twophase twophase_stream
+ repack spill slot truncate stream stats twophase twophase_stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \
twophase_snapshot slot_creation_error catalog_change_snapshot \
diff --git a/contrib/test_decoding/expected/repack.out b/contrib/test_decoding/expected/repack.out
new file mode 100644
index 00000000000..70039d824af
--- /dev/null
+++ b/contrib/test_decoding/expected/repack.out
@@ -0,0 +1,30 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+ relname | ?column?
+-----------+----------
+ ptnowner | t
+ ptnowner1 | t
+ ptnowner2 | t
+(3 rows)
+
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index cf5b74cf1ab..ac655853d26 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -34,6 +34,7 @@ tests += {
'replorigin',
'time',
'messages',
+ 'repack',
'spill',
'slot',
'truncate',
diff --git a/contrib/test_decoding/sql/repack.sql b/contrib/test_decoding/sql/repack.sql
new file mode 100644
index 00000000000..bf66bb441ac
--- /dev/null
+++ b/contrib/test_decoding/sql/repack.sql
@@ -0,0 +1,25 @@
+-- Test REPACK (CONCURRENTLY).
+-- This isn't strictly about decoding, but it involves logical decoding
+-- and requires to be run under higher than minimal wal_level, so we can't
+-- have it in the main regression test suite.
+
+
+-- Ownership of partitions is checked
+CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
+CREATE INDEX ptnowner_i_idx ON ptnowner(i);
+CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
+CREATE ROLE regress_ptnowner;
+CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
+ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
+SET SESSION AUTHORIZATION regress_ptnowner;
+ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
+REPACK (CONCURRENTLY) ptnowner1;
+RESET SESSION AUTHORIZATION;
+ALTER TABLE ptnowner OWNER TO regress_ptnowner;
+CREATE TEMP TABLE ptnowner_oldnodes AS
+ SELECT oid, relname, relfilenode FROM pg_partition_tree('ptnowner') AS tree
+ JOIN pg_class AS c ON c.oid=tree.relid;
+SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
+ JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
+DROP TABLE ptnowner;
+DROP ROLE regress_ptnowner;
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 71270134985..b767316cf6b 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -552,8 +552,6 @@ ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
ERROR: permission denied for table ptnowner
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -562,30 +560,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
WARNING: permission denied to execute CLUSTER on "ptnowner2", skipping it
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
-ERROR: cannot process relation "ptnowner1"
-HINT: Relation "ptnowner1" has no identity index.
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
- relname | ?column?
------------+----------
- ptnowner | t
- ptnowner1 | f
- ptnowner2 | t
-(3 rows)
-
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
-- Test CLUSTER with external tuplesorting
@@ -731,6 +706,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
-- checking if it handles table hierarchies identically as well.
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 6746236ffec..a22c75282ee 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -262,8 +262,6 @@ CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
-ALTER TABLE ptnowner1 REPLICA IDENTITY USING INDEX ptnowner1_i_key;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
ALTER TABLE ptnowner OWNER TO regress_ptnowner;
CREATE TEMP TABLE ptnowner_oldnodes AS
@@ -271,14 +269,7 @@ CREATE TEMP TABLE ptnowner_oldnodes AS
JOIN pg_class AS c ON c.oid=tree.relid;
SET SESSION AUTHORIZATION regress_ptnowner;
CLUSTER ptnowner USING ptnowner_i_idx;
--- still can't repack without a replica identity
-ALTER TABLE ptnowner1 REPLICA IDENTITY DEFAULT;
-REPACK (CONCURRENTLY) ptnowner1;
RESET SESSION AUTHORIZATION;
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
-SELECT a.relname, a.relfilenode=b.relfilenode FROM pg_class a
- JOIN ptnowner_oldnodes b USING (oid) ORDER BY a.relname COLLATE "C";
DROP TABLE ptnowner;
DROP ROLE regress_ptnowner;
@@ -346,6 +337,10 @@ COMMIT;
--
-- REPACK
--
+-- Note we cannot test working REPACK (CONCURRENTLY) here, because the
+-- tests could be run with wal_level=minimal, so those tests are
+-- elsewhere.
+--
----------------------------------------------------------------------
-- REPACK handles individual tables identically to CLUSTER, but it's worth
--
2.47.3
--5vljmhsecqh6fok5--
^ permalink raw reply [nested|flat] 969+ messages in thread
end of thread, other threads:[~2026-04-22 09:22 UTC | newest]
Thread overview: 969+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 21:51 Name of main process differs between servers (postmaster vs postgres) Jonathan Lemig <[email protected]>
2018-06-26 22:02 ` Justin Pryzby <[email protected]>
2018-06-26 22:04 ` David G. Johnston <[email protected]>
2018-06-27 14:09 ` Jonathan Lemig <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression tests Álvaro Herrera <[email protected]>
2026-04-22 09:22 [PATCH] Move REPACK (CONCURRENTLY) test out of stock regression 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