Re: updating table field whenever other table field changes

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: updating table field whenever other table field changes
Дата
Msg-id 3E8CDFDF.2486DCDF@Yahoo.com
обсуждение исходный текст
Ответ на updating table field whenever other table field changes  (tech7890@yahoo.com (Andrew))
Список pgsql-general
Andrew wrote:
>
> Hello postgresql.questions group!
>
> What do you think the best way to attack the following is:
> parent table a - [status_field]
>
> child table b - [status_field]
>
> I need trigger or similar to achieve the following:
> if a.status_field changes than all children of table a have their
> b.status_field change to the same value as a.

If b.status_field allways has to have a value that exists in
a.status_field (or maybe NULL if you allow it to), you want to define a
FOREIGN KEY constraint with the referential action ON UPDATE CASCADE.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Anyone know of a news group for mysql?
Следующее
От: "Robert Fitzpatrick"
Дата:
Сообщение: Converting from dbase