mirror of
https://github.com/postgres/postgres.git
synced 2026-02-27 03:40:28 -05:00
The rules regression test prints all known views and rules, which is a set that changes regularly. Previously, a change in one rule would frequently lead to whitespace changes across the entire output of this query, which is painful to verify and causes undesirable conflicts between unrelated patch sets. Use \a mode to improve matters. Also use \t mode to suppress the total-rows count, which was also a source of unnecessary patch conflicts. Likewise modify the output mode for the list of indexed tables generated in sanity_check.sql. There might be other places where we should use this idea, but these are the ones that have caused the most problems. Andres Freund
33 lines
1.1 KiB
SQL
33 lines
1.1 KiB
SQL
VACUUM;
|
|
|
|
--
|
|
-- sanity check, if we don't have indices the test will take years to
|
|
-- 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).
|
|
--
|
|
|
|
-- temporarily disable fancy output, so catalog changes create less diff noise
|
|
\a\t
|
|
|
|
SELECT relname, relhasindex
|
|
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
|
|
WHERE relkind = 'r' AND (nspname ~ '^pg_temp_') IS NOT TRUE
|
|
ORDER BY relname;
|
|
|
|
-- restore normal output mode
|
|
\a\t
|
|
|
|
--
|
|
-- 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
|
|
AND indkey[0] = -2 AND indnatts = 1
|
|
AND indisunique AND indimmediate);
|