Re: Removing Rows in Foreign Keys

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Removing Rows in Foreign Keys
Дата
Msg-id 20050404140809.GA4948@wolff.to
обсуждение исходный текст
Ответ на Removing Rows in Foreign Keys  (brew@theMode.com)
Список 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 по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: Database Encoding
Следующее
От: "Rodolfo J. Paiz"
Дата:
Сообщение: Disconnect - required, recommended, or optional?