Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql	6 Sep 2006 14:46:03 -0000	1.8
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql	7 Jul 2011 10:46:02 -0000	1.9
@@ -83,27 +83,33 @@
 
 
 
-create function content_search__itrg ()
-returns opaque as '
-begin
+CREATE OR REPLACE FUNCTION content_search__itrg () RETURNS trigger AS $$
+BEGIN
 if (select live_revision from cr_items where item_id=new.item_id) = new.revision_id and new.publish_date >= current_timestamp then
-        perform search_observer__enqueue(new.revision_id,''INSERT'');
+        perform search_observer__enqueue(new.revision_id,'INSERT');
     end if;
     return new;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
-create function content_search__dtrg ()
-returns opaque as '
-begin
-    perform search_observer__enqueue(old.revision_id,''DELETE'');
+CREATE OR REPLACE FUNCTION content_search__dtrg () RETURNS trigger AS $$
+BEGIN
+    perform search_observer__enqueue(old.revision_id,'DELETE');
     return old;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
-create or replace function content_search__utrg ()
-returns opaque as '
-declare
+
+
+--
+-- procedure content_search__utrg/0
+--
+CREATE OR REPLACE FUNCTION content_search__utrg(
+
+) RETURNS trigger AS $$
+DECLARE
     v_live_revision integer;
-begin
+BEGIN
     select into v_live_revision live_revision from
         cr_items where item_id=old.item_id;
     if old.revision_id=v_live_revision
@@ -113,31 +119,32 @@
             event
         ) values (
 old.revision_id,
-            ''UPDATE''
+            'UPDATE'
         );
     end if;
     return new;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 -- we need new triggers on cr_items to index when a live revision
 -- changes -DaveB 2002-09-26
 
-create function content_item_search__utrg ()
-returns opaque as '
-begin
+CREATE OR REPLACE FUNCTION content_item_search__utrg () RETURNS trigger AS $$
+BEGIN
     if new.live_revision is not null and coalesce(old.live_revision,0) <> new.live_revision and (select publish_date from cr_revisions where revision_id=new.live_revision) <= current_timestamp then
-        perform search_observer__enqueue(new.live_revision,''INSERT'');        
+        perform search_observer__enqueue(new.live_revision,'INSERT');        
     end if;
 
     if old.live_revision is not null and old.live_revision <> coalesce(new.live_revision,0) then
-        perform search_observer__enqueue(old.live_revision,''DELETE'');
+        perform search_observer__enqueue(old.live_revision,'DELETE');
     end if;
-    if new.publish_status = ''expired'' then
-        perform search_observer__enqueue(old.live_revision,''DELETE'');
+    if new.publish_status = 'expired' then
+        perform search_observer__enqueue(old.live_revision,'DELETE');
     end if;
 
     return new;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 create trigger content_search__itrg after insert on cr_revisions
 for each row execute procedure content_search__itrg (); 
