Re: [GENERAL] How to enumerate foreign key constraints after - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: [GENERAL] How to enumerate foreign key constraints after
Date
Msg-id 1055298304.93871.36.camel@jester
Whole thread Raw
Responses Re: [GENERAL] How to enumerate foreign key constraints after
Re: [GENERAL] How to enumerate foreign key constraints after migrating from 7.1.3?
List pgsql-hackers
Moving to -hackers.

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

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

That said, I've not heard of any issues with the current implementation
of adddepend, which is also used in a few other well used programs.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

pgsql-hackers by date:

Previous
From: Philip Yarra
Date:
Subject: Re: Feature freeze date
Next
From: Alvaro Herrera
Date:
Subject: Re: [GENERAL] How to enumerate foreign key constraints after