Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-20 Thread Timothy Covell
>Timothy, Tom: > >> >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 >> > >> >> Yes, that's what I tried. >> >> 1. foo.old.com exists in "hosts" t

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-20 Thread Stephan Szabo
On Wed, 20 Sep 2000, Josh Berkus wrote: > Timothy, Tom: > > > >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 > > > > > > > Yes, that's what

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-20 Thread Josh Berkus
Timothy, Tom: > >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 > > > > Yes, that's what I tried. > > 1. foo.old.com exists in "hosts" table and "r

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-19 Thread Jie Liang
Hi, Timothy, Try: 1. dump out the data of routes and drop it, 2. re-build your routes table, CREATE TABLE routes ( field1 type1, fqhn stype2, CONSTRAINT if_host_exists FOREIGN KEY(fqhn) REFERENCES hosts ON UPDATE CASCADE ON DELETE CASCADE ); or use alter table add constraint

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-19 Thread Stephan Szabo
On Tue, 19 Sep 2000, Timothy Covell wrote: > Schema: > hosts table with fqhn column > routes table with fqhn foreign key hosts(fqhn) > > Problem: > > 1. When I try to change fqhn in hosts, it complains that > I have now violated entry in "routes" table. > > 2. When I try to update "rou

Re: [SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-19 Thread Josh Berkus
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 updati

[SQL] [GENERAL] Foreign Keys Help Delete!

2000-09-19 Thread Timothy Covell
DB: Postgresql 7.0.2 OS: Solaris 2.6 Schema: hosts table with fqhn column routes table with fqhn foreign key hosts(fqhn) Problem: 1. When I try to change fqhn in hosts, it complains that I have now violated entry in "routes" table. 2. When I try to update "routes" table, it updates.