Re: [GENERAL] Foreign Keys Help Delete!

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Timothy Covell <dirac(at)applink(dot)net>, sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [GENERAL] Foreign Keys Help Delete!
Date: 2000-09-20 15:38:15
Message-ID: 39C8D9E7.9896E205@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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 "routes" table
> 2. create foo.new.com in "hosts" table
> 3. delete foo.old.com in "routes" table
> 4. add foo.new.com into "routes" table
> 5. try to delete foo.old.com and it complains!

Tom - not to interrupt your coding :-) this sounds like a bug. Any
thoughts?

> >2. a. Drop the Foriegn Key constraint
> > b. Update both the routes and hosts tables
> > c. Re-establish the foriegn key constraint
>
> This is the part that I'm fuzzy on. I've tried this before
> with complete DB corruption resulting. I had to dump each table
> one by one, edit my schema with vi, create new DB, import tables
> one by one....very painful!

This also sounds like a problem. One should be able to drop a
constraint, the re-create the restraint and check existing records
against it. You can do this in MSSQL and Oracle.

> PPS. As I replied to Stephan, I'm contracting at a company and I
> don't have access to e-mail. Taking a schema home is NOT OK.
> I already asked the manager if I could GPL my DNS-DB implementation.
> As you might expect, the non-technical manager, didn't know what
> GPL was, and he was NOT going to allow my work to be released to
> public.... And of course, higher ups in company may decide that
> my solution breaks the "don't build if you can buy" policy, in which
> case all of my work is for naught! ARGH!!!!!!

Well, if they don't use it, you can easily re-create your work at home
and GPL it. It also depends on the contract you signed ...

-Josh
--
______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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Papp Gyozo 2000-09-20 15:39:56 rule with multiple DELETE action part
Previous Message Robert D. Nelson 2000-09-20 15:30:00 RE: pqReadData() -- backend closed the channel unexp

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-09-20 16:13:12 Re: ERROR: replace_vars_with_subplan_refs (!?)
Previous Message Tom Lane 2000-09-20 14:43:59 Re: ERROR: replace_vars_with_subplan_refs (!?)