summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/misc_sanity.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql/misc_sanity.sql')
-rw-r--r--src/test/regress/sql/misc_sanity.sql58
1 files changed, 6 insertions, 52 deletions
diff --git a/src/test/regress/sql/misc_sanity.sql b/src/test/regress/sql/misc_sanity.sql
index 9699f5cc3b..2c0f87a651 100644
--- a/src/test/regress/sql/misc_sanity.sql
+++ b/src/test/regress/sql/misc_sanity.sql
@@ -14,70 +14,24 @@
-- **************** pg_depend ****************
-- Look for illegal values in pg_depend fields.
--- classid/objid can be zero, but only in 'p' entries
SELECT *
FROM pg_depend as d1
WHERE refclassid = 0 OR refobjid = 0 OR
- deptype NOT IN ('a', 'e', 'i', 'n', 'p') OR
- (deptype != 'p' AND (classid = 0 OR objid = 0)) OR
- (deptype = 'p' AND (classid != 0 OR objid != 0 OR objsubid != 0));
+ classid = 0 OR objid = 0 OR
+ deptype NOT IN ('a', 'e', 'i', 'n', 'x', 'P', 'S');
+
-- **************** pg_shdepend ****************
-- Look for illegal values in pg_shdepend fields.
--- classid/objid can be zero, but only in 'p' entries
SELECT *
FROM pg_shdepend as d1
WHERE refclassid = 0 OR refobjid = 0 OR
- deptype NOT IN ('a', 'o', 'p', 'r') OR
- (deptype != 'p' AND (classid = 0 OR objid = 0)) OR
- (deptype = 'p' AND (dbid != 0 OR classid != 0 OR objid != 0 OR objsubid != 0));
-
-
--- Check each OID-containing system catalog to see if its lowest-numbered OID
--- is pinned. If not, and if that OID was generated during initdb, then
--- perhaps initdb forgot to scan that catalog for pinnable entries.
--- Generally, it's okay for a catalog to be listed in the output of this
--- test if that catalog is scanned by initdb.c's setup_depend() function;
--- whatever OID the test is complaining about must have been added later
--- in initdb, where it intentionally isn't pinned. Legitimate exceptions
--- to that rule are listed in the comments in setup_depend().
--- Currently, pg_rewrite is also listed by this check, even though it is
--- covered by setup_depend(). That happens because there are no rules in
--- the pinned data, but initdb creates some intentionally-not-pinned views.
-
-do $$
-declare relnm text;
- reloid oid;
- shared bool;
- lowoid oid;
- pinned bool;
-begin
-for relnm, reloid, shared in
- select relname, oid, relisshared from pg_class
- where EXISTS(
- SELECT * FROM pg_attribute
- WHERE attrelid = pg_class.oid AND attname = 'oid')
- and relkind = 'r' and oid < 16384 order by 1
-loop
- execute 'select min(oid) from ' || relnm into lowoid;
- continue when lowoid is null or lowoid >= 16384;
- if shared then
- pinned := exists(select 1 from pg_shdepend
- where refclassid = reloid and refobjid = lowoid
- and deptype = 'p');
- else
- pinned := exists(select 1 from pg_depend
- where refclassid = reloid and refobjid = lowoid
- and deptype = 'p');
- end if;
- if not pinned then
- raise notice '% contains unpinned initdb-created object(s)', relnm;
- end if;
-end loop;
-end$$;
+ classid = 0 OR objid = 0 OR
+ deptype NOT IN ('a', 'o', 'r', 't');
+
-- **************** pg_class ****************