Re: FOREIGN KEYs ... I think ...
От | Tom Lane |
---|---|
Тема | Re: FOREIGN KEYs ... I think ... |
Дата | |
Msg-id | 27177.1136426087@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | FOREIGN KEYs ... I think ... ("Marc G. Fournier" <scrappy@postgresql.org>) |
Ответы |
Re: FOREIGN KEYs ... I think ...
|
Список | pgsql-sql |
"Marc G. Fournier" <scrappy@postgresql.org> writes: > Now, what I want to do is add a FOREIGN KEY (again, I think) that when > incident_summary.status is changed (either closed, or reopened), the > associated records in incident_comments are changed to the same state ... Why not just get rid of the status column in incident_comments, and treat incident_summary.status as the sole copy of the state? When you need to get to it from incident_comments, you do a join. The foreign key you really ought to have here is from incident_comments.incident_id to incident_summary.id (assuming that I've understood your schema correctly). regards, tom lane
В списке pgsql-sql по дате отправления: