Re: Can i force deletion of dependent rows? - Mailing list pgsql-sql

From Shoaib Mir
Subject Re: Can i force deletion of dependent rows?
Date
Msg-id bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com
Whole thread Raw
In response to Re: Can i force deletion of dependent rows?  ("Wayne E. Seguin" <wayneeseguin@gmail.com>)
Responses Re: Can i force deletion of dependent rows?  (Shruthi A <shruthi.iisc@gmail.com>)
List pgsql-sql
On Sat, Feb 13, 2010 at 10:23 PM, Wayne E. Seguin <wayneeseguin@gmail.com> wrote:
Is there another answer, asside from in the application and/or as a
trigger using `DELETE FROM B WHERE z = 'x';` as it's body?



Did you look at ON DELETE CASCADE option, check out http://www.postgresql.org/docs/8.3/interactive/ddl-constraints.html 

CREATE TABLE order_items (    product_no integer REFERENCES products ON DELETE RESTRICT,    order_id integer REFERENCES orders ON DELETE CASCADE,    quantity integer,    PRIMARY KEY (product_no, order_id) 
); 

--
Shoaib Mir
http://shoaibmir.wordpress.com/

pgsql-sql by date:

Previous
From: "Wayne E. Seguin"
Date:
Subject: Re: Can i force deletion of dependent rows?
Next
From: Shruthi A
Date:
Subject: Re: Can i force deletion of dependent rows?