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

From: Forest Wilkinson <lyris-pg(at)tibit(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Cc: Rod Taylor <rbt(at)rbt(dot)ca>
Subject: Re: [GENERAL] How to enumerate foreign key constraints after migrating from 7.1.3?
Date: 2003-06-11 17:43:50
Message-ID: 6speev4g5li21nbn7v0i17orgkjnud4d4l@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Rod Taylor <rbt(at)rbt(dot)ca> wrote:

>> 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.
>
>I assume you're doing the database upgrade for them or providing
>instructions? Could this be a mandatory portion of that process?

We're referring users to chapter 9.3 of the PostgreSQL Administrator's
Guide for data migration. Even the standard postgres dump/restore
procedure is nearly too much for our users. Anything more would be
asking for trouble.

>> 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?
>
>Yes, a combination of the two would probably be better. You would need
>to be careful about function call names for FKeys, there are a fair
>number of them. Checking for 3 triggers with the function name starting
>with RI_FKey* would probably be better.

Will the tgisconstraint flag always be set for these triggers? Will
the function names still be RI_FKey* once these databases are migrated
to postgres 7.4 or later?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Bartlett 2003-06-11 17:44:22 Re: Index not being used in MAX function (7.2.3)
Previous Message Dmitry Tkach 2003-06-11 17:36:29 VACUUM output

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2003-06-11 18:39:08 SELECT blocking on ALTER TABLE ADD FOREIGN KEY
Previous Message Hans-Jürgen Schönig 2003-06-11 17:14:06 Re: Pre-allocation of shared memory ...