Re: Is this correct behavior for ON DELETE rule?

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is this correct behavior for ON DELETE rule?
Date: 2005-02-27 18:38:09
Message-ID: BE4761A1.1AC7E%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

on 2/25/05 4:09 PM, rschumeyer(at)ieee(dot)org purportedly said:

> I have two related tables, ³item² and ³book². I have defined
> a view, ³bookview² that contains fields from item and book.
> My goal was to have all inserts, updates, and deletes performed
> on bookview rather than on the tables directly. I was able
> to do this with ON INSERT and ON UPDATE rules easily.

You may have better luck letting foreign key constraints work for you, and
specify ON DELETE CASCADE in your constraint. If, however, you don't always
want to delete related "book" rows when "item" rows are deleted, you may
want to re-think your relation.

> -- "child" table
> create table book
> (id integer references item primary key,
> title varchar(20),
> author varchar(20)
> );

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2005-02-27 19:19:46 Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.
Previous Message Karsten Hilbert 2005-02-27 17:08:02 Re: row numbering