pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rudi Starcevic <rudi@oasis.net.au>
To: pgsql-sql@postgresql.org
Subject: Referential integrity Freeze
Date: Tue, 05 Nov 2002 09:37:02 +1000
Message-ID: <3DC7049E.7080007@oasis.net.au> (raw)

    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.





view thread (3+ messages)  latest in thread

Message-ID: <3DC7049E.7080007@oasis.net.au>
Permalink:  ../3DC7049E.7080007@oasis.net.au/
Also on:    postgresql.org/message-id/3DC7049E.7080007@oasis.net.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rudi@oasis.net.au
  Subject: Re: Referential integrity Freeze
  In-Reply-To: <3DC7049E.7080007@oasis.net.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox