Skip to content

Commit a9f19c1

Browse files
committed
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 4b9fbd6, 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
1 parent b7f315c commit a9f19c1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/test/regress/expected/type_sanity.out

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -507,28 +507,30 @@ WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p', 'I') OR
507507
-----+---------
508508
(0 rows)
509509

510-
-- All tables and indexes should have an access method.
510+
-- All tables, indexes, partitioned indexes and matviews should have an
511+
-- access method.
511512
SELECT c1.oid, c1.relname
512513
FROM pg_class as c1
513-
WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c') and
514+
WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c', 'p') and
514515
c1.relam = 0;
515516
oid | relname
516517
-----+---------
517518
(0 rows)
518519

519-
-- Conversely, sequences, views, types shouldn't have them
520+
-- Conversely, sequences, views, foreign tables, types and partitioned
521+
-- tables shouldn't have them.
520522
SELECT c1.oid, c1.relname
521523
FROM pg_class as c1
522-
WHERE c1.relkind IN ('S', 'v', 'f', 'c') and
524+
WHERE c1.relkind IN ('S', 'v', 'f', 'c', 'p') and
523525
c1.relam != 0;
524526
oid | relname
525527
-----+---------
526528
(0 rows)
527529

528-
-- Indexes should have AMs of type 'i'
530+
-- Indexes and partitioned indexes should have AMs of type 'i'.
529531
SELECT pc.oid, pc.relname, pa.amname, pa.amtype
530532
FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid)
531-
WHERE pc.relkind IN ('i') and
533+
WHERE pc.relkind IN ('i', 'I') and
532534
pa.amtype != 'i';
533535
oid | relname | amname | amtype
534536
-----+---------+--------+--------

src/test/regress/sql/type_sanity.sql

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,22 +364,24 @@ WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p', 'I') OR
364364
relpersistence NOT IN ('p', 'u', 't') OR
365365
relreplident NOT IN ('d', 'n', 'f', 'i');
366366

367-
-- All tables and indexes should have an access method.
367+
-- All tables, indexes, partitioned indexes and matviews should have an
368+
-- access method.
368369
SELECT c1.oid, c1.relname
369370
FROM pg_class as c1
370-
WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c') and
371+
WHERE c1.relkind NOT IN ('S', 'v', 'f', 'c', 'p') and
371372
c1.relam = 0;
372373

373-
-- Conversely, sequences, views, types shouldn't have them
374+
-- Conversely, sequences, views, foreign tables, types and partitioned
375+
-- tables shouldn't have them.
374376
SELECT c1.oid, c1.relname
375377
FROM pg_class as c1
376-
WHERE c1.relkind IN ('S', 'v', 'f', 'c') and
378+
WHERE c1.relkind IN ('S', 'v', 'f', 'c', 'p') and
377379
c1.relam != 0;
378380

379-
-- Indexes should have AMs of type 'i'
381+
-- Indexes and partitioned indexes should have AMs of type 'i'.
380382
SELECT pc.oid, pc.relname, pa.amname, pa.amtype
381383
FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid)
382-
WHERE pc.relkind IN ('i') and
384+
WHERE pc.relkind IN ('i', 'I') and
383385
pa.amtype != 'i';
384386

385387
-- Tables, matviews etc should have AMs of type 't'

0 commit comments

Comments
 (0)