From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | brew(at)theMode(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Removing Rows in Foreign Keys |
Date: | 2005-04-04 14:08:09 |
Message-ID: | 20050404140809.GA4948@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Mon, Apr 04, 2005 at 02:56:56 -0400,
brew(at)theMode(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Rodolfo J. Paiz | 2005-04-04 16:40:38 | Disconnect - required, recommended, or optional? |
Previous Message | John DeSoi | 2005-04-04 12:05:26 | Re: Database Encoding |