Re: How to enumerate foreign key constraints after migrating from 7.1.3?

From: Forest Wilkinson <lyris-pg(at)tibit(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rod Taylor <rbt(at)rbt(dot)ca>
Subject: Re: How to enumerate foreign key constraints after migrating from 7.1.3?
Date: 2003-06-11 02:08:20
Message-ID: bo3devc02ec0etilti2207olu74bdhv1ea@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

>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?

Would this topic be more appropriate for the hackers list?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message alvis 2003-06-11 02:13:30 Re: relation model vs SQL1999 conformance vs PostgreSQL
Previous Message Andrei Gaponenko 2003-06-11 01:15:13 A client_ip() function?

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2003-06-11 02:10:52 Re: Feature freeze date
Previous Message greg 2003-06-11 01:52:57 Re: Feature freeze date