Re: Renaming unnamed FK constraints

From: Vincent Frison <turman(at)ohmforce(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Renaming unnamed FK constraints
Date: 2006-04-17 16:32:35
Message-ID: 200604171832.35808.turman@ohmforce.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Le Lundi 2006 Avril 17 18:12, Tom Lane a écrit :
> Vincent Frison <turman(at)ohmforce(dot)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?

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Brant Fitzsimmons 2006-04-17 16:39:39 Re: PostgreSQL a slow DB?
Previous Message Tom Lane 2006-04-17 16:12:52 Re: Renaming unnamed FK constraints