Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 43E0F475B99 for ; Mon, 4 Nov 2002 18:36:48 -0500 (EST) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by postgresql.org (Postfix) with ESMTP id 07900475B8F for ; Mon, 4 Nov 2002 18:36:47 -0500 (EST) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/100.1) with ESMTP id KAA18469 for ; Tue, 5 Nov 2002 10:10:21 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3DC7049E.7080007@oasis.net.au> Date: Tue, 05 Nov 2002 09:37:02 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Referential integrity Freeze Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/50 X-Sequence-Number: 10192 Hello, I have two 4 table with referential constraint's that are hanging when I try to delete from them. I have a, users table, ( 30000 rows ) suburbs table ( 16000 rows ), regions table ( 54 rows )and a bus_pc_idc table ( business type ) ( 30000 rows ) Here is my integrity rules: create table bus_pc_idc ( id serial, user_id int4 REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, sub_id int4 REFERENCES suburbs(sub_id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, idc_id int4 REFERENCES idc(id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, active bool NOT NULL DEFAULT 'f'::bool ); As the system is still being developed I want to 'empty' out the database from titme to time and rebuild it. I think that when I delete from the users table the delete should cascade through the bus_pc_idc table. However it's justing hanging when I delete all from the users table. When the database is hanging the CPU is 99% for the Postgres process. I can't see what's wrong. Perhaps I'm missing something in the referential integrity. Thanks in advance Cheers Rudi.