Re: May I have an assistance on CREATE TABLE Command

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: May I have an assistance on CREATE TABLE Command
Дата
Msg-id 48D0CB74.3060407@archonet.com
обсуждение исходный текст
Ответ на Re: May I have an assistance on CREATE TABLE Command  (James Kitambara <jameskitambara@yahoo.co.uk>)
Список pgsql-sql
James Kitambara wrote:
> For this UPDATE I wanted, when I change the region _id from '99' to
> '33' of the last ROW in REGION table  AUTOMATICALLY to change the
> last three ROWS of the DISTRICT table which reference to  '99', 'Dar
> es Salaam'.
> 
> If I do this, I will get the error message "You can not change
> region_id other tables are reference to it.
> 
> HOW CAN DO THIS? (AUTOMATIC UPDATE OF FOREIGN KEY)

When you define your foreign key mark it "ON UPDATE CASCADE" (there is a
similar option for ON DELETE). See manuals for details.

--  Richard Huxton Archonet Ltd


В списке pgsql-sql по дате отправления:

Предыдущее
От: James Kitambara
Дата:
Сообщение: Re: May I have an assistance on CREATE TABLE Command
Следующее
От: "Bart Degryse"
Дата:
Сообщение: Re: May I have an assistance on CREATE TABLE Command