pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shoaib Mir <shoaibmir@gmail.com>
To: Wayne E. Seguin <wayneeseguin@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Can i force deletion of dependent rows?
Date: Sat, 13 Feb 2010 22:32:36 +1100
Message-ID: <bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com> (raw)
In-Reply-To: <ef3e5d51002130323j13d32159we970a665ec8a0190@mail.gmail.com>
References: <6caee9521002120424l27ec8d3eq3b69522d0a773686@mail.gmail.com>
	<6caee9521002122211q7e4fd2fcj1a0489fd64dc204a@mail.gmail.com>
	<m3fx55linc.fsf@passepartout.tim-landscheidt.de>
	<ef3e5d51002130323j13d32159we970a665ec8a0190@mail.gmail.com>

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/

view thread (7+ messages)  latest in thread

Message-ID: <bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com>
Permalink:  ../bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com/
Also on:    postgresql.org/message-id/bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: shoaibmir@gmail.com, wayneeseguin@gmail.com
  Subject: Re: Can i force deletion of dependent rows?
  In-Reply-To: <bf54be871002130332h6617b33ateb4dcef3d4213054@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox