Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql,v
diff -u -r1.23 -r1.24
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql	25 Sep 2006 17:59:16 -0000	1.23
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql	16 Nov 2006 11:58:17 -0000	1.24
@@ -473,7 +473,7 @@
 -- function new
 
 select define_function_args('acs_rel__new','rel_id,rel_type,object_id_one,object_id_two,context_id,creation_user,creation_ip');
-create function acs_rel__new (integer,varchar,integer,integer,integer,integer,varchar)
+create or replace function acs_rel__new (integer,varchar,integer,integer,integer,integer,varchar)
 returns integer as '
 declare
   new__rel_id            alias for $1;  -- default null  
@@ -487,6 +487,9 @@
 begin
     -- XXX This should check that object_id_one and object_id_two are
     -- of the appropriate types.
+
+    LOCK TABLE acs_objects IN SHARE ROW EXCLUSIVE MODE;
+
     v_rel_id := acs_object__new (
       new__rel_id,
       new__rel_type,
