~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/test/regress/sql/sanity_check.sql

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
VACUUM;
 
2
 
 
3
--
 
4
-- sanity check, if we don't have indices the test will take years to
 
5
-- complete.  But skip TOAST relations since they will have varying
 
6
-- names depending on the current OID counter.
 
7
--
 
8
SELECT relname, relhasindex
 
9
   FROM pg_class
 
10
   WHERE relhasindex AND relkind != 't'
 
11
   ORDER BY relname;
 
12
 
 
13
--
 
14
-- another sanity check: every system catalog that has OIDs should have
 
15
-- a unique index on OID.  This ensures that the OIDs will be unique,
 
16
-- even after the OID counter wraps around.
 
17
-- We exclude non-system tables from the check by looking at nspname.
 
18
--
 
19
SELECT relname, nspname
 
20
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
 
21
WHERE relhasoids
 
22
    AND ((nspname ~ '^pg_') IS NOT FALSE)
 
23
    AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
 
24
                    AND indkey[0] = -2 AND indnatts = 1 AND indisunique);