Search Postgresql Archives

delete cascade not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux