Added contents.jsgo column to support <div>-level Javascript click handler.
authorrich <rich>
Wed, 26 Jul 2006 11:07:06 +0000 (11:07 +0000)
committerrich <rich>
Wed, 26 Jul 2006 11:07:06 +0000 (11:07 +0000)
Added trigger to validate this column.

Makefile
schema/cocanwiki.sql [moved from cocanwiki.sql with 91% similarity]
schema/contents_jsgo_check_tg.sql [new file with mode: 0644]

index 51cf40f..36830e1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.11 2004/11/05 12:41:52 rich Exp $
+# $Id: Makefile,v 1.12 2006/07/26 11:07:06 rich Exp $
 
 include Makefile.config
 
@@ -28,7 +28,7 @@ pkg-install:
        install -d -m 0755 $(DESTDIR)$(WIKIINSTALLDIR)/templates
        install -d -m 0755 $(DESTDIR)$(WIKIINSTALLDIR)/templates/admin
 
-       install -m 0644 cocanwiki.sql $(DESTDIR)$(WIKIINSTALLDIR)
+       install -m 0644 schema/cocanwiki.sql $(DESTDIR)$(WIKIINSTALLDIR)
        install -m 0644 conf/cocanwiki.conf $(DESTDIR)$(WIKIINSTALLDIR)/conf
        install -m 0644 html/favicon.ico $(DESTDIR)$(WIKIINSTALLDIR)/html
        install -m 0644 html/robots.txt $(DESTDIR)$(WIKIINSTALLDIR)/html
@@ -48,7 +48,7 @@ clean:
 
 FIXED_TABLES := templates themes
 
-cocanwiki.sql:
+schema/cocanwiki.sql:
        pg_dump --no-owner -i -s cocanwiki > $@
        for table in $(FIXED_TABLES); do \
          pg_dump --no-owner -i -a -t $$table cocanwiki >> $@; \
similarity index 91%
rename from cocanwiki.sql
rename to schema/cocanwiki.sql
index 4a66608..37b5439 100644 (file)
@@ -5,6 +5,26 @@
 SET client_encoding = 'UNICODE';
 SET check_function_bodies = false;
 
+SET search_path = public, pg_catalog;
+
+--
+-- TOC entry 195 (OID 14911565)
+-- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+    AS '$libdir/plpgsql', 'plpgsql_call_handler'
+    LANGUAGE c;
+
+
+--
+-- TOC entry 116 (OID 14911566)
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+
 --
 -- TOC entry 4 (OID 2200)
 -- Name: public; Type: ACL; Schema: -; Owner: postgres
@@ -15,8 +35,6 @@ REVOKE ALL ON SCHEMA public FROM postgres;
 GRANT ALL ON SCHEMA public TO PUBLIC;
 
 
-SET search_path = public, pg_catalog;
-
 --
 -- TOC entry 12 (OID 11524567)
 -- Name: pg_ts_dict; Type: TABLE; Schema: public; Owner: postgres
@@ -42,7 +60,7 @@ GRANT SELECT ON TABLE pg_ts_dict TO "www-data";
 
 
 --
--- TOC entry 116 (OID 11524574)
+-- TOC entry 117 (OID 11524574)
 -- Name: lexize(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -52,7 +70,7 @@ CREATE FUNCTION lexize(oid, text) RETURNS text[]
 
 
 --
--- TOC entry 117 (OID 11524575)
+-- TOC entry 118 (OID 11524575)
 -- Name: lexize(text, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -62,7 +80,7 @@ CREATE FUNCTION lexize(text, text) RETURNS text[]
 
 
 --
--- TOC entry 118 (OID 11524576)
+-- TOC entry 119 (OID 11524576)
 -- Name: lexize(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -72,7 +90,7 @@ CREATE FUNCTION lexize(text) RETURNS text[]
 
 
 --
--- TOC entry 119 (OID 11524577)
+-- TOC entry 120 (OID 11524577)
 -- Name: set_curdict(integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -82,7 +100,7 @@ CREATE FUNCTION set_curdict(integer) RETURNS void
 
 
 --
--- TOC entry 120 (OID 11524578)
+-- TOC entry 121 (OID 11524578)
 -- Name: set_curdict(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -92,7 +110,7 @@ CREATE FUNCTION set_curdict(text) RETURNS void
 
 
 --
--- TOC entry 121 (OID 11524579)
+-- TOC entry 122 (OID 11524579)
 -- Name: dex_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -102,7 +120,7 @@ CREATE FUNCTION dex_init(internal) RETURNS internal
 
 
 --
--- TOC entry 122 (OID 11524580)
+-- TOC entry 123 (OID 11524580)
 -- Name: dex_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -112,7 +130,7 @@ CREATE FUNCTION dex_lexize(internal, internal, integer) RETURNS internal
 
 
 --
--- TOC entry 123 (OID 11524582)
+-- TOC entry 124 (OID 11524582)
 -- Name: snb_en_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -122,7 +140,7 @@ CREATE FUNCTION snb_en_init(internal) RETURNS internal
 
 
 --
--- TOC entry 124 (OID 11524583)
+-- TOC entry 125 (OID 11524583)
 -- Name: snb_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -132,7 +150,7 @@ CREATE FUNCTION snb_lexize(internal, internal, integer) RETURNS internal
 
 
 --
--- TOC entry 125 (OID 11524585)
+-- TOC entry 126 (OID 11524585)
 -- Name: snb_ru_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -142,7 +160,7 @@ CREATE FUNCTION snb_ru_init(internal) RETURNS internal
 
 
 --
--- TOC entry 126 (OID 11524587)
+-- TOC entry 127 (OID 11524587)
 -- Name: spell_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -152,7 +170,7 @@ CREATE FUNCTION spell_init(internal) RETURNS internal
 
 
 --
--- TOC entry 127 (OID 11524588)
+-- TOC entry 128 (OID 11524588)
 -- Name: spell_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -162,7 +180,7 @@ CREATE FUNCTION spell_lexize(internal, internal, integer) RETURNS internal
 
 
 --
--- TOC entry 128 (OID 11524590)
+-- TOC entry 129 (OID 11524590)
 -- Name: syn_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -172,7 +190,7 @@ CREATE FUNCTION syn_init(internal) RETURNS internal
 
 
 --
--- TOC entry 129 (OID 11524591)
+-- TOC entry 130 (OID 11524591)
 -- Name: syn_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -220,7 +238,7 @@ CREATE TYPE tokentype AS (
 
 
 --
--- TOC entry 130 (OID 11524602)
+-- TOC entry 131 (OID 11524602)
 -- Name: token_type(integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -230,7 +248,7 @@ CREATE FUNCTION token_type(integer) RETURNS SETOF tokentype
 
 
 --
--- TOC entry 131 (OID 11524603)
+-- TOC entry 132 (OID 11524603)
 -- Name: token_type(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -240,7 +258,7 @@ CREATE FUNCTION token_type(text) RETURNS SETOF tokentype
 
 
 --
--- TOC entry 132 (OID 11524604)
+-- TOC entry 133 (OID 11524604)
 -- Name: token_type(); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -250,7 +268,7 @@ CREATE FUNCTION token_type() RETURNS SETOF tokentype
 
 
 --
--- TOC entry 133 (OID 11524605)
+-- TOC entry 134 (OID 11524605)
 -- Name: set_curprs(integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -260,7 +278,7 @@ CREATE FUNCTION set_curprs(integer) RETURNS void
 
 
 --
--- TOC entry 134 (OID 11524606)
+-- TOC entry 135 (OID 11524606)
 -- Name: set_curprs(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -281,7 +299,7 @@ CREATE TYPE tokenout AS (
 
 
 --
--- TOC entry 135 (OID 11524609)
+-- TOC entry 136 (OID 11524609)
 -- Name: parse(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -291,7 +309,7 @@ CREATE FUNCTION parse(oid, text) RETURNS SETOF tokenout
 
 
 --
--- TOC entry 136 (OID 11524610)
+-- TOC entry 137 (OID 11524610)
 -- Name: parse(text, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -301,7 +319,7 @@ CREATE FUNCTION parse(text, text) RETURNS SETOF tokenout
 
 
 --
--- TOC entry 137 (OID 11524611)
+-- TOC entry 138 (OID 11524611)
 -- Name: parse(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -311,7 +329,7 @@ CREATE FUNCTION parse(text) RETURNS SETOF tokenout
 
 
 --
--- TOC entry 138 (OID 11524612)
+-- TOC entry 139 (OID 11524612)
 -- Name: prsd_start(internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -321,7 +339,7 @@ CREATE FUNCTION prsd_start(internal, integer) RETURNS internal
 
 
 --
--- TOC entry 139 (OID 11524613)
+-- TOC entry 140 (OID 11524613)
 -- Name: prsd_getlexeme(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -331,7 +349,7 @@ CREATE FUNCTION prsd_getlexeme(internal, internal, internal) RETURNS integer
 
 
 --
--- TOC entry 140 (OID 11524614)
+-- TOC entry 141 (OID 11524614)
 -- Name: prsd_end(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -341,7 +359,7 @@ CREATE FUNCTION prsd_end(internal) RETURNS void
 
 
 --
--- TOC entry 141 (OID 11524615)
+-- TOC entry 142 (OID 11524615)
 -- Name: prsd_lextype(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -351,7 +369,7 @@ CREATE FUNCTION prsd_lextype(internal) RETURNS internal
 
 
 --
--- TOC entry 142 (OID 11524616)
+-- TOC entry 143 (OID 11524616)
 -- Name: prsd_headline(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -405,7 +423,7 @@ GRANT SELECT ON TABLE pg_ts_cfgmap TO "www-data";
 
 
 --
--- TOC entry 143 (OID 11524632)
+-- TOC entry 144 (OID 11524632)
 -- Name: set_curcfg(integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -415,7 +433,7 @@ CREATE FUNCTION set_curcfg(integer) RETURNS void
 
 
 --
--- TOC entry 144 (OID 11524633)
+-- TOC entry 145 (OID 11524633)
 -- Name: set_curcfg(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -425,7 +443,7 @@ CREATE FUNCTION set_curcfg(text) RETURNS void
 
 
 --
--- TOC entry 145 (OID 11524634)
+-- TOC entry 146 (OID 11524634)
 -- Name: show_curcfg(); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -435,7 +453,7 @@ CREATE FUNCTION show_curcfg() RETURNS oid
 
 
 --
--- TOC entry 146 (OID 11524696)
+-- TOC entry 147 (OID 11524696)
 -- Name: tsvector_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -445,7 +463,7 @@ CREATE FUNCTION tsvector_in(cstring) RETURNS tsvector
 
 
 --
--- TOC entry 147 (OID 11524697)
+-- TOC entry 148 (OID 11524697)
 -- Name: tsvector_out(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -469,7 +487,7 @@ CREATE TYPE tsvector (
 
 
 --
--- TOC entry 148 (OID 11524699)
+-- TOC entry 149 (OID 11524699)
 -- Name: length(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -479,7 +497,7 @@ CREATE FUNCTION length(tsvector) RETURNS integer
 
 
 --
--- TOC entry 149 (OID 11524700)
+-- TOC entry 150 (OID 11524700)
 -- Name: to_tsvector(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -489,7 +507,7 @@ CREATE FUNCTION to_tsvector(oid, text) RETURNS tsvector
 
 
 --
--- TOC entry 150 (OID 11524701)
+-- TOC entry 151 (OID 11524701)
 -- Name: to_tsvector(text, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -499,7 +517,7 @@ CREATE FUNCTION to_tsvector(text, text) RETURNS tsvector
 
 
 --
--- TOC entry 151 (OID 11524702)
+-- TOC entry 152 (OID 11524702)
 -- Name: to_tsvector(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -509,7 +527,7 @@ CREATE FUNCTION to_tsvector(text) RETURNS tsvector
 
 
 --
--- TOC entry 152 (OID 11524703)
+-- TOC entry 153 (OID 11524703)
 -- Name: strip(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -519,7 +537,7 @@ CREATE FUNCTION strip(tsvector) RETURNS tsvector
 
 
 --
--- TOC entry 153 (OID 11524704)
+-- TOC entry 154 (OID 11524704)
 -- Name: setweight(tsvector, "char"); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -529,7 +547,7 @@ CREATE FUNCTION setweight(tsvector, "char") RETURNS tsvector
 
 
 --
--- TOC entry 154 (OID 11524705)
+-- TOC entry 155 (OID 11524705)
 -- Name: concat(tsvector, tsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -539,7 +557,7 @@ CREATE FUNCTION concat(tsvector, tsvector) RETURNS tsvector
 
 
 --
--- TOC entry 194 (OID 11524706)
+-- TOC entry 197 (OID 11524706)
 -- Name: ||; Type: OPERATOR; Schema: public; Owner: postgres
 --
 
@@ -551,7 +569,7 @@ CREATE OPERATOR || (
 
 
 --
--- TOC entry 155 (OID 11524708)
+-- TOC entry 156 (OID 11524708)
 -- Name: tsquery_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -561,7 +579,7 @@ CREATE FUNCTION tsquery_in(cstring) RETURNS tsquery
 
 
 --
--- TOC entry 156 (OID 11524709)
+-- TOC entry 157 (OID 11524709)
 -- Name: tsquery_out(tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -585,7 +603,7 @@ CREATE TYPE tsquery (
 
 
 --
--- TOC entry 157 (OID 11524711)
+-- TOC entry 158 (OID 11524711)
 -- Name: querytree(tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -595,7 +613,7 @@ CREATE FUNCTION querytree(tsquery) RETURNS text
 
 
 --
--- TOC entry 158 (OID 11524712)
+-- TOC entry 159 (OID 11524712)
 -- Name: to_tsquery(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -605,7 +623,7 @@ CREATE FUNCTION to_tsquery(oid, text) RETURNS tsquery
 
 
 --
--- TOC entry 159 (OID 11524713)
+-- TOC entry 160 (OID 11524713)
 -- Name: to_tsquery(text, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -615,7 +633,7 @@ CREATE FUNCTION to_tsquery(text, text) RETURNS tsquery
 
 
 --
--- TOC entry 160 (OID 11524714)
+-- TOC entry 161 (OID 11524714)
 -- Name: to_tsquery(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -625,7 +643,7 @@ CREATE FUNCTION to_tsquery(text) RETURNS tsquery
 
 
 --
--- TOC entry 161 (OID 11524715)
+-- TOC entry 162 (OID 11524715)
 -- Name: exectsq(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -635,7 +653,7 @@ CREATE FUNCTION exectsq(tsvector, tsquery) RETURNS boolean
 
 
 --
--- TOC entry 163 (OID 11524716)
+-- TOC entry 164 (OID 11524716)
 -- Name: rexectsq(tsquery, tsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -645,7 +663,7 @@ CREATE FUNCTION rexectsq(tsquery, tsvector) RETURNS boolean
 
 
 --
--- TOC entry 196 (OID 11524717)
+-- TOC entry 199 (OID 11524717)
 -- Name: @@; Type: OPERATOR; Schema: public; Owner: postgres
 --
 
@@ -660,7 +678,7 @@ CREATE OPERATOR @@ (
 
 
 --
--- TOC entry 195 (OID 11524718)
+-- TOC entry 198 (OID 11524718)
 -- Name: @@; Type: OPERATOR; Schema: public; Owner: postgres
 --
 
@@ -675,7 +693,7 @@ CREATE OPERATOR @@ (
 
 
 --
--- TOC entry 165 (OID 11524719)
+-- TOC entry 166 (OID 11524719)
 -- Name: tsearch2(); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -685,7 +703,7 @@ CREATE FUNCTION tsearch2() RETURNS "trigger"
 
 
 --
--- TOC entry 166 (OID 11524720)
+-- TOC entry 167 (OID 11524720)
 -- Name: rank(real[], tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -695,7 +713,7 @@ CREATE FUNCTION rank(real[], tsvector, tsquery) RETURNS real
 
 
 --
--- TOC entry 167 (OID 11524721)
+-- TOC entry 168 (OID 11524721)
 -- Name: rank(real[], tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -705,7 +723,7 @@ CREATE FUNCTION rank(real[], tsvector, tsquery, integer) RETURNS real
 
 
 --
--- TOC entry 168 (OID 11524722)
+-- TOC entry 169 (OID 11524722)
 -- Name: rank(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -715,7 +733,7 @@ CREATE FUNCTION rank(tsvector, tsquery) RETURNS real
 
 
 --
--- TOC entry 169 (OID 11524723)
+-- TOC entry 170 (OID 11524723)
 -- Name: rank(tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -725,7 +743,7 @@ CREATE FUNCTION rank(tsvector, tsquery, integer) RETURNS real
 
 
 --
--- TOC entry 170 (OID 11524724)
+-- TOC entry 171 (OID 11524724)
 -- Name: rank_cd(integer, tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -735,7 +753,7 @@ CREATE FUNCTION rank_cd(integer, tsvector, tsquery) RETURNS real
 
 
 --
--- TOC entry 171 (OID 11524725)
+-- TOC entry 172 (OID 11524725)
 -- Name: rank_cd(integer, tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -745,7 +763,7 @@ CREATE FUNCTION rank_cd(integer, tsvector, tsquery, integer) RETURNS real
 
 
 --
--- TOC entry 172 (OID 11524726)
+-- TOC entry 173 (OID 11524726)
 -- Name: rank_cd(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -755,7 +773,7 @@ CREATE FUNCTION rank_cd(tsvector, tsquery) RETURNS real
 
 
 --
--- TOC entry 173 (OID 11524727)
+-- TOC entry 174 (OID 11524727)
 -- Name: rank_cd(tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -765,7 +783,7 @@ CREATE FUNCTION rank_cd(tsvector, tsquery, integer) RETURNS real
 
 
 --
--- TOC entry 174 (OID 11524728)
+-- TOC entry 175 (OID 11524728)
 -- Name: headline(oid, text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -775,7 +793,7 @@ CREATE FUNCTION headline(oid, text, tsquery, text) RETURNS text
 
 
 --
--- TOC entry 175 (OID 11524729)
+-- TOC entry 176 (OID 11524729)
 -- Name: headline(oid, text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -785,7 +803,7 @@ CREATE FUNCTION headline(oid, text, tsquery) RETURNS text
 
 
 --
--- TOC entry 176 (OID 11524730)
+-- TOC entry 177 (OID 11524730)
 -- Name: headline(text, text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -795,7 +813,7 @@ CREATE FUNCTION headline(text, text, tsquery, text) RETURNS text
 
 
 --
--- TOC entry 177 (OID 11524731)
+-- TOC entry 178 (OID 11524731)
 -- Name: headline(text, text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -805,7 +823,7 @@ CREATE FUNCTION headline(text, text, tsquery) RETURNS text
 
 
 --
--- TOC entry 178 (OID 11524732)
+-- TOC entry 179 (OID 11524732)
 -- Name: headline(text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -815,7 +833,7 @@ CREATE FUNCTION headline(text, tsquery, text) RETURNS text
 
 
 --
--- TOC entry 179 (OID 11524733)
+-- TOC entry 180 (OID 11524733)
 -- Name: headline(text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -825,7 +843,7 @@ CREATE FUNCTION headline(text, tsquery) RETURNS text
 
 
 --
--- TOC entry 180 (OID 11524735)
+-- TOC entry 181 (OID 11524735)
 -- Name: gtsvector_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -835,7 +853,7 @@ CREATE FUNCTION gtsvector_in(cstring) RETURNS gtsvector
 
 
 --
--- TOC entry 181 (OID 11524736)
+-- TOC entry 182 (OID 11524736)
 -- Name: gtsvector_out(gtsvector); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -859,7 +877,7 @@ CREATE TYPE gtsvector (
 
 
 --
--- TOC entry 182 (OID 11524738)
+-- TOC entry 183 (OID 11524738)
 -- Name: gtsvector_consistent(gtsvector, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -869,7 +887,7 @@ CREATE FUNCTION gtsvector_consistent(gtsvector, internal, integer) RETURNS boole
 
 
 --
--- TOC entry 183 (OID 11524739)
+-- TOC entry 184 (OID 11524739)
 -- Name: gtsvector_compress(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -879,7 +897,7 @@ CREATE FUNCTION gtsvector_compress(internal) RETURNS internal
 
 
 --
--- TOC entry 184 (OID 11524740)
+-- TOC entry 185 (OID 11524740)
 -- Name: gtsvector_decompress(internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -889,7 +907,7 @@ CREATE FUNCTION gtsvector_decompress(internal) RETURNS internal
 
 
 --
--- TOC entry 185 (OID 11524741)
+-- TOC entry 186 (OID 11524741)
 -- Name: gtsvector_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -899,7 +917,7 @@ CREATE FUNCTION gtsvector_penalty(internal, internal, internal) RETURNS internal
 
 
 --
--- TOC entry 186 (OID 11524742)
+-- TOC entry 187 (OID 11524742)
 -- Name: gtsvector_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -909,7 +927,7 @@ CREATE FUNCTION gtsvector_picksplit(internal, internal) RETURNS internal
 
 
 --
--- TOC entry 187 (OID 11524743)
+-- TOC entry 188 (OID 11524743)
 -- Name: gtsvector_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -919,7 +937,7 @@ CREATE FUNCTION gtsvector_union(bytea, internal) RETURNS integer[]
 
 
 --
--- TOC entry 188 (OID 11524744)
+-- TOC entry 189 (OID 11524744)
 -- Name: gtsvector_same(gtsvector, gtsvector, internal); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -929,7 +947,7 @@ CREATE FUNCTION gtsvector_same(gtsvector, gtsvector, internal) RETURNS internal
 
 
 --
--- TOC entry 197 (OID 11524745)
+-- TOC entry 200 (OID 11524745)
 -- Name: gist_tsvector_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres
 --
 
@@ -959,7 +977,7 @@ CREATE TYPE statinfo AS (
 
 
 --
--- TOC entry 189 (OID 11524748)
+-- TOC entry 190 (OID 11524748)
 -- Name: stat(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -969,7 +987,7 @@ CREATE FUNCTION stat(text) RETURNS SETOF statinfo
 
 
 --
--- TOC entry 190 (OID 11524749)
+-- TOC entry 191 (OID 11524749)
 -- Name: reset_tsearch(); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -979,7 +997,7 @@ CREATE FUNCTION reset_tsearch() RETURNS void
 
 
 --
--- TOC entry 191 (OID 11524750)
+-- TOC entry 192 (OID 11524750)
 -- Name: get_covers(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -1004,7 +1022,7 @@ CREATE TYPE tsdebug AS (
 
 
 --
--- TOC entry 192 (OID 11524753)
+-- TOC entry 193 (OID 11524753)
 -- Name: _get_parser_from_curcfg(); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -1014,7 +1032,7 @@ CREATE FUNCTION _get_parser_from_curcfg() RETURNS text
 
 
 --
--- TOC entry 193 (OID 11524754)
+-- TOC entry 194 (OID 11524754)
 -- Name: ts_debug(text); Type: FUNCTION; Schema: public; Owner: postgres
 --
 
@@ -1093,7 +1111,8 @@ CREATE TABLE contents (
     sectionname text,
     content text NOT NULL,
     divname text,
-    content_fti tsvector NOT NULL
+    content_fti tsvector NOT NULL,
+    jsgo text
 );
 
 
@@ -1656,6 +1675,43 @@ GRANT ALL ON TABLE pending_email_changes TO "www-data";
 
 
 --
+-- TOC entry 196 (OID 14911567)
+-- Name: contents_jsgo_check_tg(); Type: FUNCTION; Schema: public; Owner: rich
+--
+
+CREATE FUNCTION contents_jsgo_check_tg() RETURNS "trigger"
+    AS '
+
+declare
+       my_hostid integer;
+       my_count integer;
+
+begin
+       if new.jsgo is not null then
+               -- Get the hostid
+               select into my_hostid p.hostid
+                 from pages p
+                where p.id = new.pageid;
+               -- Check that (hostid, url) where url = new.jsgo exists.
+               select into my_count count(p.*)
+                 from pages p
+                where p.hostid = my_hostid
+                  and p.url = new.jsgo;
+               if my_count < 1 then
+                       raise exception ''contents.jsgo points to non-existent page (%, %)'',
+                         my_hostid, new.jsgo;
+               end if;
+       end if;
+
+       -- Everything is OK.  Return the new row unmodified.
+       return new;
+end;
+
+'
+    LANGUAGE plpgsql;
+
+
+--
 -- TOC entry 88 (OID 11576669)
 -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich
 --
@@ -2007,7 +2063,7 @@ ALTER TABLE ONLY pending_email_changes
 
 
 --
--- TOC entry 202 (OID 11576718)
+-- TOC entry 205 (OID 11576718)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2016,7 +2072,7 @@ ALTER TABLE ONLY contents
 
 
 --
--- TOC entry 206 (OID 11576722)
+-- TOC entry 209 (OID 11576722)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2025,7 +2081,7 @@ ALTER TABLE ONLY hostnames
 
 
 --
--- TOC entry 203 (OID 11576726)
+-- TOC entry 206 (OID 11576726)
 -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2034,7 +2090,7 @@ ALTER TABLE ONLY hosts
 
 
 --
--- TOC entry 198 (OID 11576730)
+-- TOC entry 201 (OID 11576730)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2043,7 +2099,7 @@ ALTER TABLE ONLY pages
 
 
 --
--- TOC entry 207 (OID 11576734)
+-- TOC entry 210 (OID 11576734)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2052,7 +2108,7 @@ ALTER TABLE ONLY images
 
 
 --
--- TOC entry 208 (OID 11576738)
+-- TOC entry 211 (OID 11576738)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2061,7 +2117,7 @@ ALTER TABLE ONLY files
 
 
 --
--- TOC entry 199 (OID 11576742)
+-- TOC entry 202 (OID 11576742)
 -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2070,7 +2126,7 @@ ALTER TABLE ONLY pages
 
 
 --
--- TOC entry 209 (OID 11576746)
+-- TOC entry 212 (OID 11576746)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2079,7 +2135,7 @@ ALTER TABLE ONLY users
 
 
 --
--- TOC entry 210 (OID 11576750)
+-- TOC entry 213 (OID 11576750)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2088,7 +2144,7 @@ ALTER TABLE ONLY usercookies
 
 
 --
--- TOC entry 200 (OID 11576754)
+-- TOC entry 203 (OID 11576754)
 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2097,7 +2153,7 @@ ALTER TABLE ONLY pages
 
 
 --
--- TOC entry 201 (OID 11576758)
+-- TOC entry 204 (OID 11576758)
 -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2106,7 +2162,7 @@ ALTER TABLE ONLY pages
 
 
 --
--- TOC entry 211 (OID 11576762)
+-- TOC entry 214 (OID 11576762)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2115,7 +2171,7 @@ ALTER TABLE ONLY sitemenu
 
 
 --
--- TOC entry 212 (OID 11576766)
+-- TOC entry 215 (OID 11576766)
 -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2124,7 +2180,7 @@ ALTER TABLE ONLY sitemenu
 
 
 --
--- TOC entry 213 (OID 11576770)
+-- TOC entry 216 (OID 11576770)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2133,7 +2189,7 @@ ALTER TABLE ONLY contacts
 
 
 --
--- TOC entry 214 (OID 11576774)
+-- TOC entry 217 (OID 11576774)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2142,7 +2198,7 @@ ALTER TABLE ONLY contact_emails
 
 
 --
--- TOC entry 204 (OID 11576778)
+-- TOC entry 207 (OID 11576778)
 -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2151,7 +2207,7 @@ ALTER TABLE ONLY hosts
 
 
 --
--- TOC entry 215 (OID 11576782)
+-- TOC entry 218 (OID 11576782)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2160,7 +2216,7 @@ ALTER TABLE ONLY page_emails
 
 
 --
--- TOC entry 216 (OID 11576786)
+-- TOC entry 219 (OID 11576786)
 -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2169,7 +2225,7 @@ ALTER TABLE ONLY page_emails
 
 
 --
--- TOC entry 217 (OID 11576790)
+-- TOC entry 220 (OID 11576790)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2178,7 +2234,7 @@ ALTER TABLE ONLY mailing_lists
 
 
 --
--- TOC entry 218 (OID 11576794)
+-- TOC entry 221 (OID 11576794)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2187,7 +2243,7 @@ ALTER TABLE ONLY links
 
 
 --
--- TOC entry 219 (OID 11576798)
+-- TOC entry 222 (OID 11576798)
 -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2196,7 +2252,7 @@ ALTER TABLE ONLY links
 
 
 --
--- TOC entry 220 (OID 11576802)
+-- TOC entry 223 (OID 11576802)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2205,7 +2261,7 @@ ALTER TABLE ONLY recently_visited
 
 
 --
--- TOC entry 221 (OID 11576806)
+-- TOC entry 224 (OID 11576806)
 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2214,7 +2270,7 @@ ALTER TABLE ONLY recently_visited
 
 
 --
--- TOC entry 222 (OID 11576810)
+-- TOC entry 225 (OID 11576810)
 -- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2223,7 +2279,7 @@ ALTER TABLE ONLY recently_visited
 
 
 --
--- TOC entry 223 (OID 11576814)
+-- TOC entry 226 (OID 11576814)
 -- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2232,7 +2288,7 @@ ALTER TABLE ONLY recently_visited
 
 
 --
--- TOC entry 225 (OID 11576818)
+-- TOC entry 228 (OID 11576818)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2241,7 +2297,7 @@ ALTER TABLE ONLY msg_references
 
 
 --
--- TOC entry 224 (OID 11576822)
+-- TOC entry 227 (OID 11576822)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2250,7 +2306,7 @@ ALTER TABLE ONLY messages
 
 
 --
--- TOC entry 205 (OID 11576826)
+-- TOC entry 208 (OID 11576826)
 -- Name: hosts_powered_by_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2259,7 +2315,7 @@ ALTER TABLE ONLY hosts
 
 
 --
--- TOC entry 226 (OID 11576830)
+-- TOC entry 229 (OID 11576830)
 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
 --
 
@@ -2268,7 +2324,7 @@ ALTER TABLE ONLY pending_email_changes
 
 
 --
--- TOC entry 227 (OID 11576834)
+-- TOC entry 230 (OID 11576834)
 -- Name: pages_fti_tr; Type: TRIGGER; Schema: public; Owner: rich
 --
 
@@ -2279,7 +2335,7 @@ CREATE TRIGGER pages_fti_tr
 
 
 --
--- TOC entry 228 (OID 11576835)
+-- TOC entry 231 (OID 11576835)
 -- Name: contents_fti_tr; Type: TRIGGER; Schema: public; Owner: rich
 --
 
@@ -2290,6 +2346,17 @@ CREATE TRIGGER contents_fti_tr
 
 
 --
+-- TOC entry 232 (OID 14911568)
+-- Name: contents_jsgo_check_tg; Type: TRIGGER; Schema: public; Owner: rich
+--
+
+CREATE TRIGGER contents_jsgo_check_tg
+    BEFORE INSERT OR UPDATE ON contents
+    FOR EACH ROW
+    EXECUTE PROCEDURE contents_jsgo_check_tg();
+
+
+--
 -- TOC entry 3 (OID 2200)
 -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
 --
@@ -2298,7 +2365,7 @@ COMMENT ON SCHEMA public IS 'Standard public namespace';
 
 
 --
--- TOC entry 162 (OID 11524715)
+-- TOC entry 163 (OID 11524715)
 -- Name: FUNCTION exectsq(tsvector, tsquery); Type: COMMENT; Schema: public; Owner: postgres
 --
 
@@ -2306,7 +2373,7 @@ COMMENT ON FUNCTION exectsq(tsvector, tsquery) IS 'boolean operation with text i
 
 
 --
--- TOC entry 164 (OID 11524716)
+-- TOC entry 165 (OID 11524716)
 -- Name: FUNCTION rexectsq(tsquery, tsvector); Type: COMMENT; Schema: public; Owner: postgres
 --
 
diff --git a/schema/contents_jsgo_check_tg.sql b/schema/contents_jsgo_check_tg.sql
new file mode 100644 (file)
index 0000000..97b0364
--- /dev/null
@@ -0,0 +1,32 @@
+-- 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 $
+
+create or replace function contents_jsgo_check_tg() returns trigger as '
+
+declare
+       my_hostid integer;
+       my_count integer;
+
+begin
+       if new.jsgo is not null then
+               -- Get the hostid
+               select into my_hostid p.hostid
+                 from pages p
+                where p.id = new.pageid;
+               -- Check that (hostid, url) where url = new.jsgo exists.
+               select into my_count count(p.*)
+                 from pages p
+                where p.hostid = my_hostid
+                  and p.url = new.jsgo;
+               if my_count < 1 then
+                       raise exception ''contents.jsgo points to non-existent page (%, %)'',
+                         my_hostid, new.jsgo;
+               end if;
+       end if;
+
+       -- Everything is OK.  Return the new row unmodified.
+       return new;
+end;
+
+' language plpgsql;
\ No newline at end of file