delete cascade not working - Mailing list pgsql-general

From Kenneth Tilton
Subject delete cascade not working
Date
Msg-id 49F36C10.3070405@gmail.com
Whole thread Raw
Responses Re: delete cascade not working
List pgsql-general
My noob understanding is that deleteing one of these:

CREATE TABLE provider_input.file_load
(
   sid serial NOT NULL,
   file_name_full text,
   file_name text,
   file_creation_date text,
   load_universal_time numeric,
   headers text,
   date timestamp without time zone DEFAULT now(),
   CONSTRAINT file_load_pkey PRIMARY KEY (sid)
)

Given constraint:

ALTER TABLE provider_input.common
   ADD CONSTRAINT common_pin_file_load_sid_fkey FOREIGN KEY
(pin_file_load_sid)
       REFERENCES provider_input.file_load (sid) MATCH FULL
       ON UPDATE NO ACTION ON DELETE CASCADE;


Would cause any of these referring to the file_load to be deleted:

CREATE TABLE provider_input.common
(
   sid serial NOT NULL,
   pin_file_load_sid integer,
   load_row_no integer,
   CONSTRAINT common_pin_file_load_sid_fkey FOREIGN KEY (pin_file_load_sid)
       REFERENCES provider_input.file_load (sid) MATCH FULL
       ON UPDATE NO ACTION ON DELETE CASCADE
)

...but I just tried it and the file_load is gone but not the items that
referenced it. Two things that might matter:

    I am using pgAdminIII to do the delete

I do not actually instantiate common, I have a table that inherits from
that. I will play around now to see if that is an issue, thought I'd
send up a flare here at the same time.

kt

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Selling an 8.1 to 8.3 upgrade
Next
From: Merlin Moncure
Date:
Subject: Re: Selling an 8.1 to 8.3 upgrade