powered_by table is fixed.
[cocanwiki.git] / schema / contents_jsgo_check_tg.sql
index 97b0364..150e6f9 100644 (file)
@@ -1,6 +1,6 @@
 -- Check the contents.jsgo field points to a valid URL.
 -- This is triggered on rows inserted or updated in contents.
--- $Id: contents_jsgo_check_tg.sql,v 1.1 2006/07/26 11:07:06 rich Exp $
+-- $Id: contents_jsgo_check_tg.sql,v 1.2 2006/07/26 13:41:34 rich Exp $
 
 create or replace function contents_jsgo_check_tg() returns trigger as '
 
@@ -18,7 +18,9 @@ begin
                select into my_count count(p.*)
                  from pages p
                 where p.hostid = my_hostid
-                  and p.url = new.jsgo;
+                   and p.url is not null
+                  and p.url = new.jsgo
+                   and p.redirect is null;
                if my_count < 1 then
                        raise exception ''contents.jsgo points to non-existent page (%, %)'',
                          my_hostid, new.jsgo;