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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Forest Wilkinson <lyris-pg(at)tibit(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to enumerate foreign key constraints after migrating from 7.1.3?
Date: 2003-06-10 21:57:26
Message-ID: 5753.1055282246@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Forest Wilkinson <lyris-pg(at)tibit(dot)com> writes:
> I'm porting a postgres client app (along with all the users'
> databases) from postgres 7.1.3 to 7.3.x. The new version of the app
> needs a way of enumerating foreign key constraints on a table,
> including the constraint names and the constrained columns.
> Unfortunately, postgres 7.1.3 didn't have a pg_constraint table, and
> the dump/restore process doesn't create the appropriate pg_constraint
> rows for foreign keys when migrating.

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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-06-10 22:00:31 Re: [GENERAL] Weird postmaster crashes
Previous Message Dmitry Tkach 2003-06-10 21:55:46 Re: [GENERAL] Weird postmaster crashes

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-06-10 22:09:06 Re: Subtitles in postgresql docs SGML?
Previous Message Josh Berkus 2003-06-10 21:52:08 Subtitles in postgresql docs SGML?