From: | Kenneth Tilton <kentilton(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | delete cascade not working |
Date: | 2009-04-25 20:01:20 |
Message-ID: | 49F36C10.3070405@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2009-04-25 20:02:36 | Re: Selling an 8.1 to 8.3 upgrade |
Previous Message | Tom Lane | 2009-04-25 15:28:15 | Re: Selling an 8.1 to 8.3 upgrade |