Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3ef16c4

Browse files
committed
Add some checks on "char"-type columns to type_sanity and opr_sanity.
I noticed that the sanity checks in the regression tests omitted to check a couple of "poor man's enum" columns that you'd reasonably expect them to check. There are other "char"-type columns in system catalogs that are not covered by either type_sanity or opr_sanity, e.g. pg_rewrite.ev_type. However, those catalogs are not populated with any manually-created data during bootstrap, so it seems less necessary to check them this way.
1 parent 26d538d commit 3ef16c4

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/test/regress/expected/opr_sanity.out

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ WHERE p1.prolang = 0 OR p1.prorettype = 0 OR
5757
array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR
5858
0::oid = ANY (p1.proargtypes) OR
5959
procost <= 0 OR
60-
CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END;
60+
CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END OR
61+
provolatile NOT IN ('i', 's', 'v') OR
62+
proparallel NOT IN ('s', 'r', 'u');
6163
oid | proname
6264
-----+---------
6365
(0 rows)

src/test/regress/expected/type_sanity.out

+3-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,9 @@ ORDER BY 1;
465465
-- Look for illegal values in pg_class fields
466466
SELECT p1.oid, p1.relname
467467
FROM pg_class as p1
468-
WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f');
468+
WHERE relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f') OR
469+
relpersistence NOT IN ('p', 'u', 't') OR
470+
relreplident NOT IN ('d', 'n', 'f', 'i');
469471
oid | relname
470472
-----+---------
471473
(0 rows)

src/test/regress/sql/opr_sanity.sql

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ WHERE p1.prolang = 0 OR p1.prorettype = 0 OR
6464
array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR
6565
0::oid = ANY (p1.proargtypes) OR
6666
procost <= 0 OR
67-
CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END;
67+
CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END OR
68+
provolatile NOT IN ('i', 's', 'v') OR
69+
proparallel NOT IN ('s', 'r', 'u');
6870

6971
-- prosrc should never be null or empty
7072
SELECT p1.oid, p1.proname

src/test/regress/sql/type_sanity.sql

+3-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ ORDER BY 1;
339339

340340
SELECT p1.oid, p1.relname
341341
FROM pg_class as p1
342-
WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f');
342+
WHERE relkind NOT IN ('r', 'i', 's', 'S', 'c', 't', 'v', 'f') OR
343+
relpersistence NOT IN ('p', 'u', 't') OR
344+
relreplident NOT IN ('d', 'n', 'f', 'i');
343345

344346
-- Indexes should have an access method, others not.
345347

0 commit comments

Comments
 (0)