Re: Renaming unnamed FK constraints - Mailing list pgsql-novice

From Vincent Frison
Subject Re: Renaming unnamed FK constraints
Date
Msg-id 200604171832.35808.turman@ohmforce.com
Whole thread Raw
In response to Re: Renaming unnamed FK constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Renaming unnamed FK constraints
List pgsql-novice
Le Lundi 2006 Avril 17 18:12, Tom Lane a écrit :
> Vincent Frison <turman@ohmforce.com> writes:
> > Yes this is right on my current PG installation (7.4 on production
> > server, 7.5
>
> 7.5?  There is no PG 7.5.

Oops I was confused by the unstable Debian postgresql package whose version is
7.5 (but server parckage is 7.4).

> > on my dev environnement): unnamed constraints are automaticely named with
> > $1, $2, $3.. But it looks like it was not the case with ealier version
> > isn't it? I say that because most of my tables was created 2 or 3 years
> > ago (I don't remember exactly on which PG versions). For this old tables,
> > I type "\d mytable" with psql there's no foreign-key constraints but only
> > triggers related to referential integrity.
>
> Yeah, before about 7.3 there was no pg_constraint catalog and thus no
> explicit representation of a foreign key constraint at all.  I believe
> that if you've just propagated a pre-7.3 schema forward via dump and
> reload, you'll still have only the triggers and not any explicit
> representation of the foreign key.  This has nothing to do with the
> syntax you used, though.

Ok thanks a lot for this explanation!

> My recommendation would be to drop all those old triggers and re-create
> the foreign key constraints.

Oh no! :(

> You could try contrib/adddepend instead of
> doing this by hand.

What do you mean by contrib/adddepend?

BTW a lot of people should have the same problem (i.e. tables creation with
unamed constraints on PG < 7.3) shouldn't they?

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Renaming unnamed FK constraints
Next
From: Brant Fitzsimmons
Date:
Subject: Re: PostgreSQL a slow DB?