1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

pgstattuple: Have pgstattuple_approx accept TOAST tables

TOAST tables have a visibility map and a free space map, so they can
be supported by pgstattuple_approx just fine.

Add test cases to show how various pgstattuple functions accept TOAST
tables.  Also add similar tests to pg_visibility, which already
accepted TOAST tables correctly but had no test coverage for them.

Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://www.postgresql.org/message-id/flat/27c4496a-02b9-dc87-8f6f-bddbef54e0fe@2ndquadrant.com
This commit is contained in:
Peter Eisentraut
2020-06-30 00:29:35 +02:00
parent ea57e531b9
commit ee0202d552
5 changed files with 52 additions and 12 deletions

View File

@ -68,12 +68,15 @@ select pg_check_frozen('test_foreign_table');
select pg_truncate_visibility_map('test_foreign_table');
-- check some of the allowed relkinds
create table regular_table (a int);
insert into regular_table values (1), (2);
create table regular_table (a int, b text);
alter table regular_table alter column b set storage external;
insert into regular_table values (1, repeat('one', 1000)), (2, repeat('two', 1000));
vacuum regular_table;
select count(*) > 0 from pg_visibility('regular_table');
select count(*) > 0 from pg_visibility((select reltoastrelid from pg_class where relname = 'regular_table'));
truncate regular_table;
select count(*) > 0 from pg_visibility('regular_table');
select count(*) > 0 from pg_visibility((select reltoastrelid from pg_class where relname = 'regular_table'));
create materialized view matview_visibility_test as select * from regular_table;
vacuum matview_visibility_test;