Re: Can i force deletion of dependent rows?

From: Shoaib Mir <shoaibmir(at)gmail(dot)com>
To: "Wayne E(dot) Seguin" <wayneeseguin(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Can i force deletion of dependent rows?
Date: 2010-02-13 11:32:36
Message-ID: bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Feb 13, 2010 at 10:23 PM, Wayne E. Seguin <wayneeseguin(at)gmail(dot)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/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Shruthi A 2010-02-13 17:25:21 Re: Can i force deletion of dependent rows?
Previous Message Wayne E. Seguin 2010-02-13 11:23:53 Re: Can i force deletion of dependent rows?