Find all foreign keys and dropping them from a script.

From: "Robert Landsmeer" <r(dot)landsmeer(at)wis(dot)nl>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Find all foreign keys and dropping them from a script.
Date: 2006-04-18 14:05:48
Message-ID: 50CA25BD6EEA954FA592C097399942E30E463CC2@CM1.wis.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello all,

I am having a hard time finding all foreign keys on my database trough a
script and then removing them.

The reason I need to do this is that the application I am using has data
that has been altered within an update of the product.

To update the database we have a script that will execute all the data
updates of the product. Since the updater isn't aware of what updates
need to be done before other updates FK-wise we get all kinds of errors
about incorrect data, and the script fails. So we want to drop all
foreign keys, insert a lot of data, and then re-add all foreign keys. We
already have a script that re-adds all foreign keys and also adds the
new foreign keys for the new product release.

So at the moment I am looking for a way to get all current FK's trough a
JDBC connection. Since a script will auto generate the drop key scripts
it would be nice to have a way to do this. But after some searching on
the internet I could not find a nice way of doing this (if I have missed
a resource, please feel free to point me to it :-) ).

Thanks in advance,

Robert

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Florian Reiser 2006-04-18 14:13:20 Re: The COPY command and csv files
Previous Message Tom Lane 2006-04-18 14:02:09 Re: The COPY command and csv files