Re: Removing Rows in Foreign Keys - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Removing Rows in Foreign Keys
Date
Msg-id 20050404140809.GA4948@wolff.to
Whole thread Raw
In response to Removing Rows in Foreign Keys  (brew@theMode.com)
List pgsql-novice
On Mon, Apr 04, 2005 at 02:56:56 -0400,
  brew@theMode.com wrote:
>
> Well, I confess.  Although I've several databases running on postgreSQL
> I've never done more than just store data. (no constaints, no triggers, no
> functions, not even any transactions) I'm setting up a new schema for a
> new database and am learning about using foreign keys.
>
> Is there a SQL command that removes both a row in a table and the rows in
> other tables that reference it or do I have to do it manually?
>
> Sort of like 'DELETE CASCADE....." which I tried, to no avail. Perusing
> the manual didn't reveal anything....

If you use foreign keys that are set to on DELETE CASCADE then deleting
a referenced row will also delete all of the rows that reference it.

pgsql-novice by date:

Previous
From: John DeSoi
Date:
Subject: Re: Database Encoding
Next
From: "Rodolfo J. Paiz"
Date:
Subject: Disconnect - required, recommended, or optional?