Re: UPDATE/INSERT on multiple co-dependent tables

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: UPDATE/INSERT on multiple co-dependent tables
Дата
Msg-id 20041114094724.J568@hermes.hilbert.loc
обсуждение исходный текст
Ответ на UPDATE/INSERT on multiple co-dependent tables  (Ferindo Middleton Jr <fmiddleton@sleekcollar.com>)
Список pgsql-sql
> Is it possible for an UPDATE/INSERT query string to function in such a
> way that it requires two like fields in different tables to be equal
> to/'in sync with' one another: 
> 
> Example: I have two tables: registration & schedules.... 
> they both record a class_id, start_date,  end_date... I want to make
> sure that if the schedule_id field is updated in the registration table;
> that class_id, start_date & end_date fields automatically change to
> match the schedules.id record in the schedules table....
Sounds like you want a foreign key with ON UPDATE CASCADE. If
that doesn't work for some reason or other you might be able
to achieve what you need with an explicit trigger on update of
registration.schedule_id.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


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

Предыдущее
От: "Contact AR-SD.NET"
Дата:
Сообщение: Re: upper/lower for german characters
Следующее
От: Theodore Petrosky
Дата:
Сообщение: Re: postgreSQL 8beta