Index: acs-content-repository/tcl/content-revision-procs.tcl
===================================================================
RCS file: /cvsroot/openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 content-revision-procs.tcl
--- acs-content-repository/tcl/content-revision-procs.tcl	17 Oct 2005 12:10:09 -0000	1.9.2.3
+++ acs-content-repository/tcl/content-revision-procs.tcl	15 Jul 2006 23:24:04 -0000
@@ -125,16 +125,18 @@
     }
     
     set table_name [db_string get_table_name "select table_name from acs_object_types where object_type=:content_type"]
-    set table_name "${table_name}i"
 
-    set query_text "insert into ${table_name}
+    set query_text "insert into ${table_name}i
                     (revision_id, object_type, creation_user, creation_date, creation_ip, title, description, item_id, object_package_id, mime_type $attribute_names)
             values (:revision_id, :content_type, :creation_user, :creation_date, :creation_ip, :title, :description, :item_id, :package_id, :mime_type $attribute_values)"
     db_transaction {
-        if {[string equal "" $revision_id]} {
+        db_dml lock_objects "LOCK TABLE acs_objects IN SHARE ROW EXCLUSIVE MODE"
+        if {$revision_id eq ""} {
 	    set revision_id [db_nextval "acs_object_id_seq"]
 	}
-        db_dml insert_revision $query_text
+        # the postgres "insert into view" is rewritten by the rule into a "select"
+        [expr {[db_driverkey ""] eq "postgresql" ? "db_0or1row" : "db_dml"}] \
+	    insert_revision $query_text
         update_content \
             -revision_id $revision_id \
             -content $content
Index: dynamic-types/tcl/form-procs.tcl
===================================================================
RCS file: /cvsroot/openacs-4/packages/dynamic-types/tcl/form-procs.tcl,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 form-procs.tcl
--- dynamic-types/tcl/form-procs.tcl	30 Nov 2005 16:19:09 -0000	1.5.2.1
+++ dynamic-types/tcl/form-procs.tcl	15 Jul 2006 23:29:20 -0000
@@ -399,6 +399,9 @@
     # Perform the insert or update as appropriate
     #
 
+    # the postgres "insert into view" is rewritten by the rule into a "select", so no dml..
+    set db_stmt [expr {[db_driverkey ""] eq "postgresql" ? "db_0or1row" : "db_dml"}] 
+
     # title, description, object_title
     if {$content_type_p} {
 	set pos [lsearch -exact $columns package_id]
@@ -408,7 +411,7 @@
 
 	db_transaction {
 	    if {$new_p} { 
-		db_dml insert_statement "
+		$db_stmt insert_statement "
                     insert into ${type_info(table_name)}i 
                     ([join $columns ", "])
                     values 
@@ -417,7 +420,7 @@
 		set latest_revision [content::item::get_latest_revision -item_id $item_id]
 		set object_id [db_nextval acs_object_id_seq]
 
-		db_dml insert_statement "
+		$db_stmt insert_statement "
                     insert into ${type_info(table_name)}i 
                     ([join [concat $columns $missing_columns] ", "])
                     select  
@@ -453,7 +456,7 @@
 	}
     } else {
 	if {$new_p} { 
-	    db_dml insert_statement "
+	    $db_stmt insert_statement "
                 insert into ${type_info(table_name)}i ([join $columns ", "])
                 values ([join $values ", "])"
 	} else {
Index: xotcl-core/tcl/generic-procs.tcl
===================================================================
RCS file: /cvsroot/openacs-4/packages/xotcl-core/tcl/generic-procs.tcl,v
retrieving revision 1.16.2.4
diff -u -r1.16.2.4 generic-procs.tcl
--- xotcl-core/tcl/generic-procs.tcl	17 Jun 2006 23:48:19 -0000	1.16.2.4
+++ xotcl-core/tcl/generic-procs.tcl	16 Jul 2006 00:28:39 -0000
@@ -519,11 +519,9 @@
 
     db_transaction {
       set revision_id [db_nextval acs_object_id_seq]
-      db_dml revision_add "insert into [[my info class] set table_name]i ([join $__atts ,]) \
+      db_0or1row revision_add "insert into [[my info class] set table_name]i ([join $__atts ,]) \
 	values (:[join $__atts ,:])"
-      db_exec_plsql make_live {
-	select content_item__set_live_revision(:revision_id)
-      }
+      db_0or1row make_live {select content_item__set_live_revision(:revision_id)}
     }
     return $item_id
   }
@@ -550,20 +548,19 @@
     db_transaction {
       $__class instvar storage_type object_type
       $__class folder_type -folder_id $parent_id register
-       set item_id [db_exec_plsql note_insert "
+      db_dml lock_objects "LOCK TABLE acs_objects IN SHARE ROW EXCLUSIVE MODE"
+      set item_id [db_string insert_item "
 	select content_item__new(:name,$parent_id,null,null,null,:creation_user,null,null,
 				 'content_item',:object_type,:title,
 				 :description,:mime_type,
 				 :nls_language,:text,:storage_type)"]
       
       set revision_id [db_nextval acs_object_id_seq]
-      db_dml revision_add "
+      db_0or1row revision_add "
 	insert into [$__class set table_name]i ([join $__atts ,]) 
 	values (:[join $__atts ,:])"
       
-      db_exec_plsql make_live {
-	select content_item__set_live_revision(:revision_id)
-      }
+      db_0or1row make_live {select content_item__set_live_revision(:revision_id)}
     }
     return $item_id
   }
