From 970d8a39736fd67e3ebf406ed8129eed0767d15d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 23 Apr 2011 14:49:54 -0400 Subject: [PATCH] Update oidjoins regression test for 9.1 catalog schema additions. --- src/test/regress/expected/oidjoins.out | 72 ++++++++++++++++++++++ src/test/regress/sql/oidjoins.sql | 36 +++++++++++ src/tools/findoidjoins/README | 17 +++-- src/tools/findoidjoins/make_oidjoins_check | 6 +- 4 files changed, 124 insertions(+), 7 deletions(-) diff --git a/src/test/regress/expected/oidjoins.out b/src/test/regress/expected/oidjoins.out index 9fa0f845cf..348033354c 100644 --- a/src/test/regress/expected/oidjoins.out +++ b/src/test/regress/expected/oidjoins.out @@ -121,6 +121,14 @@ WHERE ambuild != 0 AND ------+--------- (0 rows) +SELECT ctid, ambuildempty +FROM pg_catalog.pg_am fk +WHERE ambuildempty != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.ambuildempty); + ctid | ambuildempty +------+-------------- +(0 rows) + SELECT ctid, ambulkdelete FROM pg_catalog.pg_am fk WHERE ambulkdelete != 0 AND @@ -193,6 +201,14 @@ WHERE amopmethod != 0 AND ------+------------ (0 rows) +SELECT ctid, amopsortfamily +FROM pg_catalog.pg_amop fk +WHERE amopsortfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.amopsortfamily); + ctid | amopsortfamily +------+---------------- +(0 rows) + SELECT ctid, amprocfamily FROM pg_catalog.pg_amproc fk WHERE amprocfamily != 0 AND @@ -241,6 +257,14 @@ WHERE atttypid != 0 AND ------+---------- (0 rows) +SELECT ctid, attcollation +FROM pg_catalog.pg_attribute fk +WHERE attcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.attcollation); + ctid | attcollation +------+-------------- +(0 rows) + SELECT ctid, castsource FROM pg_catalog.pg_cast fk WHERE castsource != 0 AND @@ -321,6 +345,22 @@ WHERE reltoastidxid != 0 AND ------+--------------- (0 rows) +SELECT ctid, collnamespace +FROM pg_catalog.pg_collation fk +WHERE collnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.collnamespace); + ctid | collnamespace +------+--------------- +(0 rows) + +SELECT ctid, collowner +FROM pg_catalog.pg_collation fk +WHERE collowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.collowner); + ctid | collowner +------+----------- +(0 rows) + SELECT ctid, connamespace FROM pg_catalog.pg_constraint fk WHERE connamespace != 0 AND @@ -409,6 +449,22 @@ WHERE classoid != 0 AND ------+---------- (0 rows) +SELECT ctid, extowner +FROM pg_catalog.pg_extension fk +WHERE extowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.extowner); + ctid | extowner +------+---------- +(0 rows) + +SELECT ctid, extnamespace +FROM pg_catalog.pg_extension fk +WHERE extnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.extnamespace); + ctid | extnamespace +------+-------------- +(0 rows) + SELECT ctid, indexrelid FROM pg_catalog.pg_index fk WHERE indexrelid != 0 AND @@ -641,6 +697,14 @@ WHERE prolang != 0 AND ------+--------- (0 rows) +SELECT ctid, provariadic +FROM pg_catalog.pg_proc fk +WHERE provariadic != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.provariadic); + ctid | provariadic +------+------------- +(0 rows) + SELECT ctid, prorettype FROM pg_catalog.pg_proc fk WHERE prorettype != 0 AND @@ -953,3 +1017,11 @@ WHERE typbasetype != 0 AND ------+------------- (0 rows) +SELECT ctid, typcollation +FROM pg_catalog.pg_type fk +WHERE typcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.typcollation); + ctid | typcollation +------+-------------- +(0 rows) + diff --git a/src/test/regress/sql/oidjoins.sql b/src/test/regress/sql/oidjoins.sql index 995271b690..5be38cff58 100644 --- a/src/test/regress/sql/oidjoins.sql +++ b/src/test/regress/sql/oidjoins.sql @@ -61,6 +61,10 @@ SELECT ctid, ambuild FROM pg_catalog.pg_am fk WHERE ambuild != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.ambuild); +SELECT ctid, ambuildempty +FROM pg_catalog.pg_am fk +WHERE ambuildempty != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.ambuildempty); SELECT ctid, ambulkdelete FROM pg_catalog.pg_am fk WHERE ambulkdelete != 0 AND @@ -97,6 +101,10 @@ SELECT ctid, amopmethod FROM pg_catalog.pg_amop fk WHERE amopmethod != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_am pk WHERE pk.oid = fk.amopmethod); +SELECT ctid, amopsortfamily +FROM pg_catalog.pg_amop fk +WHERE amopsortfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.amopsortfamily); SELECT ctid, amprocfamily FROM pg_catalog.pg_amproc fk WHERE amprocfamily != 0 AND @@ -121,6 +129,10 @@ SELECT ctid, atttypid FROM pg_catalog.pg_attribute fk WHERE atttypid != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.atttypid); +SELECT ctid, attcollation +FROM pg_catalog.pg_attribute fk +WHERE attcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.attcollation); SELECT ctid, castsource FROM pg_catalog.pg_cast fk WHERE castsource != 0 AND @@ -161,6 +173,14 @@ SELECT ctid, reltoastidxid FROM pg_catalog.pg_class fk WHERE reltoastidxid != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.reltoastidxid); +SELECT ctid, collnamespace +FROM pg_catalog.pg_collation fk +WHERE collnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.collnamespace); +SELECT ctid, collowner +FROM pg_catalog.pg_collation fk +WHERE collowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.collowner); SELECT ctid, connamespace FROM pg_catalog.pg_constraint fk WHERE connamespace != 0 AND @@ -205,6 +225,14 @@ SELECT ctid, classoid FROM pg_catalog.pg_description fk WHERE classoid != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.classoid); +SELECT ctid, extowner +FROM pg_catalog.pg_extension fk +WHERE extowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.extowner); +SELECT ctid, extnamespace +FROM pg_catalog.pg_extension fk +WHERE extnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.extnamespace); SELECT ctid, indexrelid FROM pg_catalog.pg_index fk WHERE indexrelid != 0 AND @@ -321,6 +349,10 @@ SELECT ctid, prolang FROM pg_catalog.pg_proc fk WHERE prolang != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_language pk WHERE pk.oid = fk.prolang); +SELECT ctid, provariadic +FROM pg_catalog.pg_proc fk +WHERE provariadic != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.provariadic); SELECT ctid, prorettype FROM pg_catalog.pg_proc fk WHERE prorettype != 0 AND @@ -477,3 +509,7 @@ SELECT ctid, typbasetype FROM pg_catalog.pg_type fk WHERE typbasetype != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.typbasetype); +SELECT ctid, typcollation +FROM pg_catalog.pg_type fk +WHERE typcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.typcollation); diff --git a/src/tools/findoidjoins/README b/src/tools/findoidjoins/README index 0685d6cf21..8bc11d0b4c 100644 --- a/src/tools/findoidjoins/README +++ b/src/tools/findoidjoins/README @@ -9,10 +9,10 @@ anything but an empty database, such as template1; else it's likely to be very slow. Run on an empty database, it returns the system join relationships (shown -below for 9.0devel). Note that unexpected matches may indicate bogus entries +below for 9.1devel). Note that unexpected matches may indicate bogus entries in system tables --- don't accept a peculiar match without question. In particular, a field shown as joining to more than one target table is -probably messed up. In 9.0devel, the *only* fields that should join to more +probably messed up. In 9.1devel, the *only* fields that should join to more than one target are pg_description.objoid, pg_depend.objid, pg_depend.refobjid, pg_shdescription.objoid, pg_shdepend.objid, and pg_shdepend.refobjid. (Running make_oidjoins_check is an easy way to spot @@ -31,7 +31,7 @@ revision in the patterns of cross-links between system tables. (Ideally we'd just regenerate the script as part of the regression tests themselves, but that seems too slow...) -NOTE: in 9.0devel, make_oidjoins_check produces two bogus join checks: +NOTE: in 9.1devel, make_oidjoins_check produces two bogus join checks: Join pg_catalog.pg_class.relfilenode => pg_catalog.pg_class.oid Join pg_catalog.pg_database.datlastsysoid => pg_catalog.pg_database.oid These are artifacts and should not be added to the oidjoins regress test. @@ -55,6 +55,7 @@ Join pg_catalog.pg_am.amendscan => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.ammarkpos => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.amrestrpos => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.ambuild => pg_catalog.pg_proc.oid +Join pg_catalog.pg_am.ambuildempty => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.ambulkdelete => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.amvacuumcleanup => pg_catalog.pg_proc.oid Join pg_catalog.pg_am.amcostestimate => pg_catalog.pg_proc.oid @@ -64,12 +65,14 @@ Join pg_catalog.pg_amop.amoplefttype => pg_catalog.pg_type.oid Join pg_catalog.pg_amop.amoprighttype => pg_catalog.pg_type.oid Join pg_catalog.pg_amop.amopopr => pg_catalog.pg_operator.oid Join pg_catalog.pg_amop.amopmethod => pg_catalog.pg_am.oid +Join pg_catalog.pg_amop.amopsortfamily => pg_catalog.pg_opfamily.oid Join pg_catalog.pg_amproc.amprocfamily => pg_catalog.pg_opfamily.oid Join pg_catalog.pg_amproc.amproclefttype => pg_catalog.pg_type.oid Join pg_catalog.pg_amproc.amprocrighttype => pg_catalog.pg_type.oid Join pg_catalog.pg_amproc.amproc => pg_catalog.pg_proc.oid Join pg_catalog.pg_attribute.attrelid => pg_catalog.pg_class.oid Join pg_catalog.pg_attribute.atttypid => pg_catalog.pg_type.oid +Join pg_catalog.pg_attribute.attcollation => pg_catalog.pg_collation.oid Join pg_catalog.pg_cast.castsource => pg_catalog.pg_type.oid Join pg_catalog.pg_cast.casttarget => pg_catalog.pg_type.oid Join pg_catalog.pg_cast.castfunc => pg_catalog.pg_proc.oid @@ -80,6 +83,8 @@ Join pg_catalog.pg_class.relam => pg_catalog.pg_am.oid Join pg_catalog.pg_class.reltablespace => pg_catalog.pg_tablespace.oid Join pg_catalog.pg_class.reltoastrelid => pg_catalog.pg_class.oid Join pg_catalog.pg_class.reltoastidxid => pg_catalog.pg_class.oid +Join pg_catalog.pg_collation.collnamespace => pg_catalog.pg_namespace.oid +Join pg_catalog.pg_collation.collowner => pg_catalog.pg_authid.oid Join pg_catalog.pg_constraint.connamespace => pg_catalog.pg_namespace.oid Join pg_catalog.pg_constraint.contypid => pg_catalog.pg_type.oid Join pg_catalog.pg_conversion.connamespace => pg_catalog.pg_namespace.oid @@ -91,6 +96,8 @@ Join pg_catalog.pg_db_role_setting.setdatabase => pg_catalog.pg_database.oid Join pg_catalog.pg_depend.classid => pg_catalog.pg_class.oid Join pg_catalog.pg_depend.refclassid => pg_catalog.pg_class.oid Join pg_catalog.pg_description.classoid => pg_catalog.pg_class.oid +Join pg_catalog.pg_extension.extowner => pg_catalog.pg_authid.oid +Join pg_catalog.pg_extension.extnamespace => pg_catalog.pg_namespace.oid Join pg_catalog.pg_index.indexrelid => pg_catalog.pg_class.oid Join pg_catalog.pg_index.indrelid => pg_catalog.pg_class.oid Join pg_catalog.pg_language.lanowner => pg_catalog.pg_authid.oid @@ -120,6 +127,7 @@ Join pg_catalog.pg_opfamily.opfowner => pg_catalog.pg_authid.oid Join pg_catalog.pg_proc.pronamespace => pg_catalog.pg_namespace.oid Join pg_catalog.pg_proc.proowner => pg_catalog.pg_authid.oid Join pg_catalog.pg_proc.prolang => pg_catalog.pg_language.oid +Join pg_catalog.pg_proc.provariadic => pg_catalog.pg_type.oid Join pg_catalog.pg_proc.prorettype => pg_catalog.pg_type.oid Join pg_catalog.pg_rewrite.ev_class => pg_catalog.pg_class.oid Join pg_catalog.pg_shdepend.refclassid => pg_catalog.pg_class.oid @@ -159,8 +167,9 @@ Join pg_catalog.pg_type.typmodin => pg_catalog.pg_proc.oid Join pg_catalog.pg_type.typmodout => pg_catalog.pg_proc.oid Join pg_catalog.pg_type.typanalyze => pg_catalog.pg_proc.oid Join pg_catalog.pg_type.typbasetype => pg_catalog.pg_type.oid +Join pg_catalog.pg_type.typcollation => pg_catalog.pg_collation.oid --------------------------------------------------------------------------- -Bruce Momjian (root@candle.pha.pa.us) +Bruce Momjian (bruce@momjian.us) Updated for 7.3 by Joe Conway (mail@joeconway.com) diff --git a/src/tools/findoidjoins/make_oidjoins_check b/src/tools/findoidjoins/make_oidjoins_check index 59ac76aaba..5c2742e01b 100755 --- a/src/tools/findoidjoins/make_oidjoins_check +++ b/src/tools/findoidjoins/make_oidjoins_check @@ -59,9 +59,9 @@ $AWK -F'[ \.]' '\ } { printf "\ -SELECT ctid, %s \n\ -FROM %s.%s fk \n\ -WHERE %s != 0 AND \n\ +SELECT ctid, %s\n\ +FROM %s.%s fk\n\ +WHERE %s != 0 AND\n\ NOT EXISTS(SELECT 1 FROM %s.%s pk WHERE pk.oid = fk.%s);\n", $4, $2, $3, $4, $6, $7, $4;