-- #6957 v03-0006: what a failed REPACK (CONCURRENTLY) leaves behind. -- Needs --enable-injection-points. Tested on v03 applied on be00f041a33. \set VERBOSITY terse \pset pager off CREATE EXTENSION injection_points; CREATE TABLE t (id int PRIMARY KEY, v text); INSERT INTO t SELECT g, repeat('x', 200) FROM generate_series(1, 20000) g; SELECT pg_relation_size('t') / 8192 AS t_blocks; -- Make the copy fail after the new heap's creation has been committed. SET repack_snapshot_after = 10; SELECT injection_points_attach('repack-concurrently-new-range', 'error'); REPACK (CONCURRENTLY) t; SELECT injection_points_detach('repack-concurrently-new-range'); RESET repack_snapshot_after; \echo == 1. what is left in the catalog SELECT c.relname, c.relnamespace::regnamespace AS nsp, c.relkind, pg_size_pretty(pg_total_relation_size(c.oid)) AS size, c.relrewrite::regclass AS relrewrite FROM pg_class c WHERE c.relname LIKE 'pg_temp_%' AND c.relnamespace = 'public'::regnamespace ORDER BY 1; \echo == 2. commands that rewrite t through make_new_heap() VACUUM FULL t; CLUSTER t USING t_pkey; REPACK t; ALTER TABLE t ALTER id TYPE bigint; ALTER TABLE t ADD COLUMN w float8 DEFAULT random(); \echo == 3. the table itself is fine SELECT count(*) FROM t; \echo == 4. a successful REPACK (CONCURRENTLY) drops the leftover REPACK (CONCURRENTLY) t; VACUUM FULL t;