Add support for PostgreSQL 9.2, drop TSearch2 extension user/dbs/pg92_compat
authorDan Scott <dscott@laurentian.ca>
Sat, 22 Sep 2012 20:35:43 +0000 (16:35 -0400)
committerDan Scott <dscott@laurentian.ca>
Sat, 22 Sep 2012 20:41:53 +0000 (16:41 -0400)
The TSearch2 extension hasn't been needed for a long time, and it causes
problems trying to use ts_rewrite(TSQUERY, TEXT) at least.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/create_database_9_1.sql
Open-ILS/src/sql/Pg/create_database_9_2.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg92.fts-config.sql
new file mode 100644 (file)
index 0000000..7ddce06
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2004-2008  Georgia Public Library Service
+ * Copyright (C) 2008  Equinox Software, Inc., Laurentian University
+ * Mike Rylander <miker@esilibrary.com>
+ * Dan Scott <dscott@laurentian.ca>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+BEGIN;
+
+SET search_path = public, pg_catalog;
+
+CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
+BEGIN
+       NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
+       RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+
+DROP TEXT SEARCH DICTIONARY IF EXISTS english_nostop CASCADE;
+
+CREATE TEXT SEARCH DICTIONARY english_nostop (TEMPLATE=pg_catalog.snowball, language='english');
+COMMENT ON TEXT SEARCH DICTIONARY english_nostop IS 'English snowball stemmer with no stopwords for ASCII words only.';
+
+CREATE TEXT SEARCH CONFIGURATION title ( COPY = pg_catalog.english );
+ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
+ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH english_nostop;
+CREATE TEXT SEARCH CONFIGURATION author ( COPY = title );
+CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title );
+CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title );
+CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title );
+CREATE TEXT SEARCH CONFIGURATION series ( COPY = title );
+CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = title );
+
+COMMIT;
index dd6066f..e06ac59 100644 (file)
@@ -14,10 +14,8 @@ CREATE DATABASE :db_name TEMPLATE template0 ENCODING 'UNICODE' LC_COLLATE 'C' LC
 
 \connect :db_name
 
---CREATE LANGUAGE plperl;
 CREATE LANGUAGE plperlu;
 
 CREATE EXTENSION tablefunc;
-CREATE EXTENSION tsearch2;
 CREATE EXTENSION xml2;
 CREATE EXTENSION hstore;
diff --git a/Open-ILS/src/sql/Pg/create_database_9_2.sql b/Open-ILS/src/sql/Pg/create_database_9_2.sql
new file mode 100644 (file)
index 0000000..e06ac59
--- /dev/null
@@ -0,0 +1,21 @@
+-- This file is intended to be called by eg_db_config.pl
+
+-- If manually calling:
+-- Connect to the postgres database initially
+-- Specify the database to create as -vdb_name=DATABASE
+-- Specify the postgres contrib directory as -vcontrib_dir=CONTRIBDIR
+-- You can get the contrib directory using pg_config --sharedir and adding a /contrib to it
+
+-- NOTE: This file does not do transactions
+-- This is intentional. Please do not wrap in BEGIN/COMMIT.
+DROP DATABASE IF EXISTS :db_name;
+
+CREATE DATABASE :db_name TEMPLATE template0 ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C';
+
+\connect :db_name
+
+CREATE LANGUAGE plperlu;
+
+CREATE EXTENSION tablefunc;
+CREATE EXTENSION xml2;
+CREATE EXTENSION hstore;