Re: How to enumerate foreign key constraints after migrating - Mailing list pgsql-general

From Stephan Szabo
Subject Re: How to enumerate foreign key constraints after migrating
Date
Msg-id 20030610191900.H73673-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: How to enumerate foreign key constraints after migrating from 7.1.3?  (Forest Wilkinson <lyris-pg@tibit.com>)
Responses Re: How to enumerate foreign key constraints after migrating from 7.1.3?  (Forest Wilkinson <lyris-pg@tibit.com>)
List pgsql-general
On Tue, 10 Jun 2003, Forest Wilkinson wrote:

> >I believe there is a contrib module to help with updating foreign keys
> >into proper 7.3 form.  Look in contrib/adddepend.
> >
> >> With that in mind, how can I
> >> enumerate foreign key constraints in any database, whether it was
> >> originally created with postgres 7.1.3 or 7.3.x?
> >
> >Something looking at the triggers might work, but I'd recommend just
> >getting the pg_constraint entries to exist and then using those.
>
> Unfortunately, having all my users run contrib/adddepend isn't an
> option for me.  However, that script does contain a good deal of
> information that I may be able to use for detecting old-style foreign
> key constraints in my own code.
>
> Okay, more questions:
> I see that adddepend detects old-style foreign key constraints by
> looking for groups of 3 triggers having 6 or more identical function
> arguments.  Is that the best way to do it?  It occurs to me that an
> alternative might be to find triggers that call RI_FKey_check_ins()
> and have the tgisconstraint flag set.  Will either approach be safe in
> postgres 7.4?  Perhaps a combination of the two would be best?

Without looking at the other triggers, you can't determine the referential
action information since that's encoded in the functions the other two
triggers call.


pgsql-general by date:

Previous
From:
Date:
Subject: Re: relation model vs SQL1999 conformance vs PostgreSQL
Next
From: Edmund Dengler
Date:
Subject: Performance of query (fwd)