Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by hub.org (8.10.1/8.10.1) with ESMTP id e8K0BQs76747 for ; Tue, 19 Sep 2000 20:11:27 -0400 (EDT) Received: from [206.169.43.135] (HELO agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.3) with ESMTP id 1090693 for pgsql-sql@postgresql.org; Tue, 19 Sep 2000 17:11:26 -0700 Message-ID: <39C7FFFB.6A9A0A2B@agliodbs.com> Date: Tue, 19 Sep 2000 17:08:27 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions X-Mailer: Mozilla 4.73 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: sqllist Subject: Re: [GENERAL] Foreign Keys Help Delete! References: <000371abbd90c460_mailit@smtp.applink.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200009/141 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@agliodbs.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