1 -- Check the contents.jsgo field points to a valid URL.
2 -- This is triggered on rows inserted or updated in contents.
3 -- $Id: contents_jsgo_check_tg.sql,v 1.2 2006/07/26 13:41:34 rich Exp $
5 create or replace function contents_jsgo_check_tg() returns trigger as '
12 if new.jsgo is not null then
14 select into my_hostid p.hostid
16 where p.id = new.pageid;
17 -- Check that (hostid, url) where url = new.jsgo exists.
18 select into my_count count(p.*)
20 where p.hostid = my_hostid
23 and p.redirect is null;
25 raise exception ''contents.jsgo points to non-existent page (%, %)'',
30 -- Everything is OK. Return the new row unmodified.