aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-11-12 10:06:51 +0900
committerMichael Paquier <michael@paquier.xyz>2023-11-12 10:06:51 +0900
commita9f19c1349c22819038842a0debba2c86b4832b8 (patch)
treeb38616f8cfca3f5608cbbd90aeb0a4c53699fc48
parentb7f315c9d7d839dda847b10d170ffec7c3f4dbba (diff)
downloadpostgresql-a9f19c1349c22819038842a0debba2c86b4832b8.tar.gz
postgresql-a9f19c1349c22819038842a0debba2c86b4832b8.zip
Fix inconsistencies for queries on pg_class in type_sanity.sql
Three queries did not consider partitioned indexes and tables, and surrounding comments have not been updated in a while. Like 4b9fbd6be442, this is only cosmetic currently as no such relkinds exist at this stage of the regression tests, but running these queries on existing clusters could lead to incorrect results. Author: Jian He, Michael Paquier Discussion: https://postgr.es/m/CACJufxGsB1ciahkNDccyxhw-Pfp_-_y+Wx+1BOdRyVVxKojAbg@mail.gmail.com
-rw-r--r--src/test/regress/expected/type_sanity.out14
-rw-r--r--src/test/regress/sql/type_sanity.sql14
2 files changed, 16 insertions, 12 deletions
diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out
index eca2c0516ff..88d8f6c32d6 100644
--- a/src/test/regress/expected/type_sanity.out
+++ b/src/test/regress/expected/type_sanity.out
@@ -507,28 +507,30 @@ WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p', 'I') OR
-----+---------
(0 rows)
--- All tables and indexes should have an access method.
+-- All tables, indexes, partitioned indexes and matviews should have an
+-- access method.
SELECT c1.oid, c1.relname
FROM pg_class as c1
-WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c') and
+WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c', 'p') and
c1.relam = 0;
oid | relname
-----+---------
(0 rows)
--- Conversely, sequences, views, types shouldn't have them
+-- Conversely, sequences, views, foreign tables, types and partitioned
+-- tables shouldn't have them.
SELECT c1.oid, c1.relname
FROM pg_class as c1
-WHERE c1.relkind IN ('S', 'v', 'f', 'c') and
+WHERE c1.relkind IN ('S', 'v', 'f', 'c', 'p') and
c1.relam != 0;
oid | relname
-----+---------
(0 rows)
--- Indexes should have AMs of type 'i'
+-- Indexes and partitioned indexes should have AMs of type 'i'.
SELECT pc.oid, pc.relname, pa.amname, pa.amtype
FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid)
-WHERE pc.relkind IN ('i') and
+WHERE pc.relkind IN ('i', 'I') and
pa.amtype != 'i';
oid | relname | amname | amtype
-----+---------+--------+--------
diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql
index a546ba89de9..e88d6cbe49d 100644
--- a/src/test/regress/sql/type_sanity.sql
+++ b/src/test/regress/sql/type_sanity.sql
@@ -364,22 +364,24 @@ WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p', 'I') OR
relpersistence NOT IN ('p', 'u', 't') OR
relreplident NOT IN ('d', 'n', 'f', 'i');
--- All tables and indexes should have an access method.
+-- All tables, indexes, partitioned indexes and matviews should have an
+-- access method.
SELECT c1.oid, c1.relname
FROM pg_class as c1
-WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c') and
+WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c', 'p') and
c1.relam = 0;
--- Conversely, sequences, views, types shouldn't have them
+-- Conversely, sequences, views, foreign tables, types and partitioned
+-- tables shouldn't have them.
SELECT c1.oid, c1.relname
FROM pg_class as c1
-WHERE c1.relkind IN ('S', 'v', 'f', 'c') and
+WHERE c1.relkind IN ('S', 'v', 'f', 'c', 'p') and
c1.relam != 0;
--- Indexes should have AMs of type 'i'
+-- Indexes and partitioned indexes should have AMs of type 'i'.
SELECT pc.oid, pc.relname, pa.amname, pa.amtype
FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid)
-WHERE pc.relkind IN ('i') and
+WHERE pc.relkind IN ('i', 'I') and
pa.amtype != 'i';
-- Tables, matviews etc should have AMs of type 't'