Re: rule or trigger?
От | Stephan Szabo |
---|---|
Тема | Re: rule or trigger? |
Дата | |
Msg-id | 20050607065228.O97782@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | rule or trigger? ("M.D.G. Lange" <mlange@dltmedia.nl>) |
Список | pgsql-sql |
On Tue, 7 Jun 2005, M.D.G. Lange wrote: > It is not possible to create a constraint Foreign key for "wordid". No > problem there, but I want to be certain that a given wordid exists in > tbldictionary. > Would I have to create a "RULE" or a "TRIGGER" to be certain that the > wordid is existing in tbldictionary in whatever language. > > I have the idea that a trigger will not prevent the insertion, or did I > not read well enough? What you can do in an after trigger is test that the value exists in the other table or raise an error (which is basically what the foreign key triggers do). There are some issues with writing your own, the first being that to get full foreign key style semantics you need triggers on the referenced table as well, however if removing or updating the wordid in tbldictionary is uncommon, you can probably avoid it.
В списке pgsql-sql по дате отправления: