From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | sqllist <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] Foreign Keys Help Delete! |
Date: | 2000-09-20 00:08:27 |
Message-ID: | 39C7FFFB.6A9A0A2B@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Mr. Covell,
> 2. When I try to update "routes" table, it updates.
Actually, what I'm curious about is this part. Most databases that
support foriegn keys will not allow you to modify them as long as a
relation exists referencing the key, on either the master or child side,
unless you are updating the child to NULL (if the column is nullable) or
a valid alternative forign key value.
If you have updated the child record so that no records reference the
master key value, that key value should be then updatable without
violating the Forign Key constraint. However, I have not had reason to
test this on 7.0.2.
This provides you with two approaches for updating BOTH hosts and routes
table:
1. a. Create new record with new key value in hosts table with the
desired value
b. Update the routes record to reference the new value
c. Delete the old record in the hosts table
2. a. Drop the Foriegn Key constraint
b. Update both the routes and hosts tables
c. Re-establish the foriegn key constraint
If either of these approaches doesn't work, you have a valid bug
report. COngratulations!
-Josh Berkus
--
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 436-9166
for law firms, small businesses fax 436-0137
and non-profit organizations. pager 338-4078
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-09-20 00:37:22 | Re: [SQL] Foreign Keys Help Delete! |
Previous Message | Tom Lane | 2000-09-19 23:55:46 | Re: nasty problem with redhat 6.2 + pg 7.02 |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-09-20 00:37:22 | Re: [SQL] Foreign Keys Help Delete! |
Previous Message | Timothy Covell | 2000-09-19 23:49:23 | Foreign Keys Help Delete! |