summaryrefslogtreecommitdiff
path: root/maintenance/postgres/archives/patch-tsearch2funcs.sql
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /maintenance/postgres/archives/patch-tsearch2funcs.sql
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'maintenance/postgres/archives/patch-tsearch2funcs.sql')
-rw-r--r--maintenance/postgres/archives/patch-tsearch2funcs.sql29
1 files changed, 29 insertions, 0 deletions
diff --git a/maintenance/postgres/archives/patch-tsearch2funcs.sql b/maintenance/postgres/archives/patch-tsearch2funcs.sql
new file mode 100644
index 00000000..c24efef3
--- /dev/null
+++ b/maintenance/postgres/archives/patch-tsearch2funcs.sql
@@ -0,0 +1,29 @@
+-- Should be run on Postgres 8.3 or newer to remove the 'default'
+
+CREATE OR REPLACE FUNCTION ts2_page_title()
+RETURNS TRIGGER
+LANGUAGE plpgsql AS
+$mw$
+BEGIN
+IF TG_OP = 'INSERT' THEN
+ NEW.titlevector = to_tsvector(REPLACE(NEW.page_title,'/',' '));
+ELSIF NEW.page_title != OLD.page_title THEN
+ NEW.titlevector := to_tsvector(REPLACE(NEW.page_title,'/',' '));
+END IF;
+RETURN NEW;
+END;
+$mw$;
+
+CREATE OR REPLACE FUNCTION ts2_page_text()
+RETURNS TRIGGER
+LANGUAGE plpgsql AS
+$mw$
+BEGIN
+IF TG_OP = 'INSERT' THEN
+ NEW.textvector = to_tsvector(NEW.old_text);
+ELSIF NEW.old_text != OLD.old_text THEN
+ NEW.textvector := to_tsvector(NEW.old_text);
+END IF;
+RETURN NEW;
+END;
+$mw$;