Index: openacs-4/packages/chat/sql/postgresql/upgrade/upgrade-5.0d8-5.0d9.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/chat/sql/postgresql/upgrade/upgrade-5.0d8-5.0d9.sql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/chat/sql/postgresql/upgrade/upgrade-5.0d8-5.0d9.sql	14 Dec 2010 15:04:44 -0000	1.1
+++ openacs-4/packages/chat/sql/postgresql/upgrade/upgrade-5.0d8-5.0d9.sql	7 Aug 2017 23:48:07 -0000	1.2
@@ -1,26 +1,32 @@
 -- PG 9.0 support 
 -- @author Victor Guerra ( vguerra@gmail.com )
 
-create or replace function chat_room__message_post (integer, varchar, integer, varchar)
-returns integer as '
-declare
-   p_room_id        alias for $1;
-   p_msg            alias for $2;
-   p_creation_user  alias for $3;
-   p_creation_ip    alias for $4;
-   -- p_html_p         alias for $3;
-   -- p_approved_p     alias for $4;
+
+
+-- added
+select define_function_args('chat_room__message_post','room_id,msg,html_p,approved_p');
+
+--
+-- procedure chat_room__message_post/4
+--
+CREATE OR REPLACE FUNCTION chat_room__message_post(
+   p_room_id integer,
+   p_msg varchar,
+   p_html_p integer,
+   p_approved_p varchar
+) RETURNS integer AS $$
+DECLARE
    v_msg_id chat_msgs.msg_id%TYPE;
    v_msg_archive_p chat_rooms.archive_p%TYPE;
    v_msg chat_msgs.msg%TYPE;
-begin
+BEGIN
     -- Get msg id from the global acs_object sequence.
-    select nextval(''t_acs_object_id_seq'') into v_msg_id from dual;
+    select nextval('t_acs_object_id_seq') into v_msg_id from dual;
 
 
     select archive_p into v_msg_archive_p from chat_rooms where room_id = p_room_id;
 
-    if v_msg_archive_p = ''t'' then
+    if v_msg_archive_p = 't' then
             v_msg := p_msg;
         else
             v_msg := null;
@@ -46,4 +52,5 @@
 
 
 return 0;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
