1997-04-06 10:29:57 +02:00
|
|
|
VACUUM;
|
2002-08-10 17:54:04 +02:00
|
|
|
|
1997-04-06 08:07:13 +02:00
|
|
|
--
|
|
|
|
-- sanity check, if we don't have indices the test will take years to
|
2006-08-06 06:35:21 +02:00
|
|
|
-- complete. But skip TOAST relations (since they will have varying
|
|
|
|
-- names depending on the current OID counter) as well as temp tables
|
|
|
|
-- of other backends (to avoid timing-dependent behavior).
|
1997-04-06 08:07:13 +02:00
|
|
|
--
|
2013-10-26 17:24:04 +02:00
|
|
|
|
|
|
|
-- temporarily disable fancy output, so catalog changes create less diff noise
|
|
|
|
\a\t
|
|
|
|
|
1997-04-06 08:07:13 +02:00
|
|
|
SELECT relname, relhasindex
|
2006-08-06 06:35:21 +02:00
|
|
|
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
2017-03-07 17:32:33 +01:00
|
|
|
WHERE relkind IN ('r', 'P') AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
1997-04-06 08:07:13 +02:00
|
|
|
ORDER BY relname;
|
|
|
|
|
2013-10-26 17:24:04 +02:00
|
|
|
-- restore normal output mode
|
|
|
|
\a\t
|
|
|
|
|
2002-08-10 17:54:04 +02:00
|
|
|
--
|
|
|
|
-- another sanity check: every system catalog that has OIDs should have
|
|
|
|
-- a unique index on OID. This ensures that the OIDs will be unique,
|
|
|
|
-- even after the OID counter wraps around.
|
|
|
|
-- We exclude non-system tables from the check by looking at nspname.
|
|
|
|
--
|
|
|
|
SELECT relname, nspname
|
|
|
|
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
|
|
|
WHERE relhasoids
|
|
|
|
AND ((nspname ~ '^pg_') IS NOT FALSE)
|
|
|
|
AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
|
2009-07-29 22:56:21 +02:00
|
|
|
AND indkey[0] = -2 AND indnatts = 1
|
|
|
|
AND indisunique AND indimmediate);
|