head	1.10;
access;
symbols
	REL7_0_PATCHES:1.8.0.2
	REL7_0:1.8
	REL6_5_PATCHES:1.6.0.2
	REL6_5:1.6
	REL6_4:1.4.0.2;
locks; strict;
comment	@# @;


1.10
date	2000.06.19.14.06.33;	author momjian;	state dead;
branches;
next	1.9;

1.9
date	2000.06.19.13.53.27;	author momjian;	state Exp;
branches;
next	1.8;

1.8
date	2000.01.22.23.05.14;	author tgl;	state Exp;
branches;
next	1.7;

1.7
date	99.10.11.17.46.54;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	99.03.27.17.26.25;	author tgl;	state Exp;
branches;
next	1.5;

1.5
date	99.03.26.07.21.58;	author tgl;	state Exp;
branches;
next	1.4;

1.4
date	98.09.14.01.14.45;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	98.08.11.18.28.08;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	98.08.11.05.32.40;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	98.08.11.02.31.55;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.10
log
@Remove old README files.
@
text
@@


1.9
log
@Update to /contrib from Karel.
@
text
@@


1.8
log
@findoidjoins was suffering from bit rot (pginterface no
longer in expected location).
@
text
@a0 90

   			      findoidjoins

This program scans a database, and prints oid fields (also regproc fields)
and the tables they join to.  CAUTION: it is ver-r-r-y slow on a large
database, or even a not-so-large one.  We don't really recommend running
it on anything but an empty database, such as template1.

Uses pgeasy library.

Run on an empty database, it returns the system join relationships (shown
below for 7.0).  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 7.0, the *only* field that should join to more
than one target is pg_description.objoid.  (Running make_oidjoins_check
is an easy way to spot fields joining to more than one table, BTW.)

The shell script make_oidjoins_check converts findoidjoins' output
into an SQL script that checks for dangling links (entries in an
OID or REGPROC column that don't match any row in the expected table).
Note that fields joining to more than one table are NOT processed.

The result of make_oidjoins_check should be installed as the "oidjoins"
regression test.  The oidjoins test should be updated after any
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...)

---------------------------------------------------------------------------

Join pg_aggregate.aggtransfn1 => pg_proc.oid
Join pg_aggregate.aggtransfn2 => pg_proc.oid
Join pg_aggregate.aggfinalfn => pg_proc.oid
Join pg_aggregate.aggbasetype => pg_type.oid
Join pg_aggregate.aggtranstype1 => pg_type.oid
Join pg_aggregate.aggtranstype2 => pg_type.oid
Join pg_aggregate.aggfinaltype => pg_type.oid
Join pg_am.amgettuple => pg_proc.oid
Join pg_am.aminsert => pg_proc.oid
Join pg_am.amdelete => pg_proc.oid
Join pg_am.ambeginscan => pg_proc.oid
Join pg_am.amrescan => pg_proc.oid
Join pg_am.amendscan => pg_proc.oid
Join pg_am.ammarkpos => pg_proc.oid
Join pg_am.amrestrpos => pg_proc.oid
Join pg_am.ambuild => pg_proc.oid
Join pg_am.amcostestimate => pg_proc.oid
Join pg_amop.amopid => pg_am.oid
Join pg_amop.amopclaid => pg_opclass.oid
Join pg_amop.amopopr => pg_operator.oid
Join pg_amproc.amid => pg_am.oid
Join pg_amproc.amopclaid => pg_opclass.oid
Join pg_amproc.amproc => pg_proc.oid
Join pg_attribute.attrelid => pg_class.oid
Join pg_attribute.atttypid => pg_type.oid
Join pg_class.reltype => pg_type.oid
Join pg_class.relam => pg_am.oid
Join pg_description.objoid => pg_proc.oid
Join pg_description.objoid => pg_type.oid
Join pg_index.indexrelid => pg_class.oid
Join pg_index.indrelid => pg_class.oid
Join pg_opclass.opcdeftype => pg_type.oid
Join pg_operator.oprleft => pg_type.oid
Join pg_operator.oprright => pg_type.oid
Join pg_operator.oprresult => pg_type.oid
Join pg_operator.oprcom => pg_operator.oid
Join pg_operator.oprnegate => pg_operator.oid
Join pg_operator.oprlsortop => pg_operator.oid
Join pg_operator.oprrsortop => pg_operator.oid
Join pg_operator.oprcode => pg_proc.oid
Join pg_operator.oprrest => pg_proc.oid
Join pg_operator.oprjoin => pg_proc.oid
Join pg_proc.prolang => pg_language.oid
Join pg_proc.prorettype => pg_type.oid
Join pg_rewrite.ev_class => pg_class.oid
Join pg_statistic.starelid => pg_class.oid
Join pg_statistic.staop => pg_operator.oid
Join pg_trigger.tgrelid => pg_class.oid
Join pg_trigger.tgfoid => pg_proc.oid
Join pg_type.typrelid => pg_class.oid
Join pg_type.typelem => pg_type.oid
Join pg_type.typinput => pg_proc.oid
Join pg_type.typoutput => pg_proc.oid
Join pg_type.typreceive => pg_proc.oid
Join pg_type.typsend => pg_proc.oid

---------------------------------------------------------------------------

Bruce Momjian (root@@candle.pha.pa.us)
@


1.7
log
@Add pginterface into main tree, called pgeasy.
@
text
@d7 1
a7 1
it on anything but an empty database.
d12 1
a12 1
below for 6.5).  Note that unexpected matches may indicate bogus entries
d15 1
a15 1
probably messed up.  In 6.5, the *only* field that should join to more
d48 1
a51 2
Join pg_amop.amopselect => pg_proc.oid
Join pg_amop.amopnpages => pg_proc.oid
d77 4
@


1.6
log
@Delete unused system table pg_parg.
@
text
@d9 1
a9 1
It requires pgsql/contrib/pginterface to be compiled first.
@


1.5
log
@Update findoidjoins for 6.5: remove workaround for long-dead bug,
use NOT EXISTS() which is a lot faster than NOT IN (),
update documentation.
@
text
@d4 4
a7 4
This program scans a database, and prints oid fields and the tables
they join to.  CAUTION: it is ver-r-r-y slow on a large database, or
even a not-so-large one.  We don't really recommend running it on
anything but an empty database.
d11 7
a17 5
Run on an empty database, it returns the system join relationships
(shown below for 6.5).  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.
d21 4
a24 2
OID column that don't match any row in the expected table).
The result of this script should be installed as the "oidjoins"
a74 3
Join pg_parg.parproid => pg_operator.oid
Join pg_parg.parproid => pg_proc.oid
Join pg_parg.partype => pg_type.oid
@


1.4
log
@Add new make_oidjoin_check utility and template1_check.sql.  Fix some
pg_operator problems.
@
text
@a1 1

d4 21
a24 8
This program scans the a database, and prints oid fields, and the tables
they join to.  PostgreSQL version 6.3.2 crashes with aggregates on
views, so I have removed the view pg_user from the list of relations to
examine.

It requires /pgsql/contrib/pginterface to be compiled first.

Run on am empty database, it returns the system join relationships:
a30 1
Join pg_aggregate.aggbasetype => pg_proc.oid
a31 1
Join pg_aggregate.aggtranstype1 => pg_proc.oid
a33 1
Join pg_aggregate.aggfinaltype => pg_proc.oid
a46 1
Join pg_amop.amopopr => pg_proc.oid
a50 3
Join pg_amproc.amopclaid => pg_operator.oid
Join pg_amproc.amopclaid => pg_proc.oid
Join pg_amproc.amproc => pg_operator.oid
a77 2
Join pg_type.typelem => pg_operator.oid
Join pg_type.typelem => pg_proc.oid
a82 1

@


1.3
log
@Change owner from oid to int4 type.
@
text
@d38 1
a54 1
Join pg_index.indproc => pg_proc.oid
@


1.2
log
@Remove NOBTREE defines, and make findoidlinks handle regproc.
@
text
@d16 3
a20 6
Join pg_aggregate.aggfinalfn => pg_proc.oid
Join pg_aggregate.aggfinaltype => pg_proc.oid
Join pg_aggregate.aggfinaltype => pg_type.oid
Join pg_aggregate.aggowner => pg_proc.oid
Join pg_aggregate.aggtransfn1 => pg_proc.oid
Join pg_aggregate.aggtransfn2 => pg_proc.oid
d24 5
d30 1
a30 2
Join pg_am.ambuild => pg_proc.oid
Join pg_am.amdelete => pg_proc.oid
a31 2
Join pg_am.amgettuple => pg_proc.oid
Join pg_am.aminsert => pg_proc.oid
a32 2
Join pg_am.amowner => pg_proc.oid
Join pg_am.amrescan => pg_proc.oid
d34 2
a36 2
Join pg_amop.amopid => pg_am.oid
Join pg_amop.amopnpages => pg_proc.oid
d39 1
d48 1
a49 2
Join pg_class.relowner => pg_proc.oid
Join pg_class.reltype => pg_type.oid
d53 1
a54 1
Join pg_index.indrelid => pg_class.oid
d56 3
a58 1
Join pg_operator.oprcode => pg_proc.oid
d60 1
a60 2
Join pg_operator.oprjoin => pg_proc.oid
Join pg_operator.oprleft => pg_type.oid
d62 2
a63 2
Join pg_operator.oprnegate => pg_operator.oid
Join pg_operator.oprowner => pg_proc.oid
d65 1
a65 3
Join pg_operator.oprresult => pg_type.oid
Join pg_operator.oprright => pg_type.oid
Join pg_operator.oprrsortop => pg_operator.oid
a69 1
Join pg_proc.proowner => pg_proc.oid
d72 1
a72 1
Join pg_statistic.starelid => pg_class.oid
a77 1
Join pg_type.typowner => pg_proc.oid
a78 1
Join pg_type.typrelid => pg_class.oid
@


1.1
log
@New findoidjoins examines oid columns to find join relationships.
@
text
@d10 2
d16 3
d22 2
a23 2
Join pg_aggregate.aggbasetype => pg_proc.oid
Join pg_aggregate.aggbasetype => pg_type.oid
d27 7
d35 3
d39 1
d41 2
a42 3
Join pg_amop.amopclaid => pg_opclass.oid
Join pg_amproc.amproc => pg_operator.oid
Join pg_amproc.amproc => pg_proc.oid
d46 2
a47 1
Join pg_amproc.amid => pg_am.oid
d51 1
a52 1
Join pg_class.relowner => pg_proc.oid
d56 1
a57 1
Join pg_index.indproc => pg_proc.oid
d59 1
d61 2
a62 1
Join pg_operator.oprrsortop => pg_operator.oid
d65 2
d69 1
a69 3
Join pg_operator.oprleft => pg_type.oid
Join pg_operator.oprowner => pg_proc.oid
Join pg_parg.partype => pg_type.oid
d72 1
d74 1
a75 1
Join pg_proc.proowner => pg_proc.oid
a77 2
Join pg_type.typrelid => pg_class.oid
Join pg_type.typowner => pg_proc.oid
d81 6
@

