summaryrefslogtreecommitdiff
path: root/contrib/pgstattuple/sql/pgstattuple.sql
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2024-09-12 16:31:29 -0500
committerNathan Bossart <nathan@postgresql.org>2024-09-12 16:31:29 -0500
commitca902529cc0fea8a0ef660b519640da09a2680ef (patch)
treee642a82f6eb17597173e534035879b98d9044434 /contrib/pgstattuple/sql/pgstattuple.sql
parentabed06fdc5b23ca2b11adac236d43b6328fcfae1 (diff)
Reintroduce support for sequences in pgstattuple and pageinspect.
Commit 4b82664156 restricted a number of functions provided by contrib modules to only relations that use the "heap" table access method. Sequences always use this table access method, but they do not advertise as such in the pg_class system catalog, so the aforementioned commit also (presumably unintentionally) removed support for sequences from some of these functions. This commit reintroduces said support for sequences to these functions and adds a couple of relevant tests. Co-authored-by: Ayush Vatsa Reviewed-by: Robert Haas, Michael Paquier, Matthias van de Meent Discussion: https://postgr.es/m/CACX%2BKaP3i%2Bi9tdPLjF5JCHVv93xobEdcd_eB%2B638VDvZ3i%3DcQA%40mail.gmail.com Backpatch-through: 12
Diffstat (limited to 'contrib/pgstattuple/sql/pgstattuple.sql')
-rw-r--r--contrib/pgstattuple/sql/pgstattuple.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/pgstattuple/sql/pgstattuple.sql b/contrib/pgstattuple/sql/pgstattuple.sql
index 6a6846fd9ae..2c19befe65f 100644
--- a/contrib/pgstattuple/sql/pgstattuple.sql
+++ b/contrib/pgstattuple/sql/pgstattuple.sql
@@ -114,6 +114,18 @@ create index test_partition_hash_idx on test_partition using hash (a);
select pgstatindex('test_partition_idx');
select pgstathashindex('test_partition_hash_idx');
+-- these should work for sequences
+create sequence test_sequence;
+select count(*) from pgstattuple('test_sequence');
+select pg_relpages('test_sequence');
+
+-- these should fail for sequences
+select pgstatindex('test_sequence');
+select pgstatginindex('test_sequence');
+select pgstathashindex('test_sequence');
+select pgstattuple_approx('test_sequence');
+
+drop sequence test_sequence;
drop table test_partitioned;
drop view test_view;
drop foreign table test_foreign_table;