create extension pg_surgery;
-- create a normal heap table and insert some rows.
--- note that we don't commit the transaction, so autovacuum can't interfere.
-begin;
-create table htab(a int);
+-- use a temp table so that vacuum behavior doesn't depend on global xmin
+create temp table htab (a int);
insert into htab values (100), (200), (300), (400), (500);
-- test empty TID array
select heap_force_freeze('htab'::regclass, ARRAY[]::tid[]);
(1 row)
-rollback;
-- set up a new table with a redirected line pointer
-create table htab2(a int) with (autovacuum_enabled = off);
+-- use a temp table so that vacuum behavior doesn't depend on global xmin
+create temp table htab2(a int);
insert into htab2 values (100);
update htab2 set a = 200;
vacuum htab2;
select heap_force_freeze('vw'::regclass, ARRAY['(0, 1)']::tid[]);
ERROR: "vw" is not a table, materialized view, or TOAST table
-- cleanup.
-drop table htab2;
drop view vw;
drop extension pg_surgery;
create extension pg_surgery;
-- create a normal heap table and insert some rows.
--- note that we don't commit the transaction, so autovacuum can't interfere.
-begin;
-create table htab(a int);
+-- use a temp table so that vacuum behavior doesn't depend on global xmin
+create temp table htab (a int);
insert into htab values (100), (200), (300), (400), (500);
-- test empty TID array
-- out-of-range TIDs should be skipped
select heap_force_freeze('htab'::regclass, ARRAY['(0, 0)', '(0, 6)']::tid[]);
-rollback;
-
-- set up a new table with a redirected line pointer
-create table htab2(a int) with (autovacuum_enabled = off);
+-- use a temp table so that vacuum behavior doesn't depend on global xmin
+create temp table htab2(a int);
insert into htab2 values (100);
update htab2 set a = 200;
vacuum htab2;
select heap_force_freeze('vw'::regclass, ARRAY['(0, 1)']::tid[]);
-- cleanup.
-drop table htab2;
drop view vw;
drop extension pg_surgery;