On Sat, Feb 13, 2010 at 10:23 PM, Wayne E. Seguin <wayneeseg...@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/

Reply via email to