diff --git a/webform.install b/webform.install
index adae53f..dcfa395 100644
--- a/webform.install
+++ b/webform.install
@@ -1777,13 +1777,13 @@ function webform_update_7415() {
  * Add columns for serial numbered submissions. Add serial numbers to existing submissions.
  */
 function webform_update_7416() {
+  // Postgres has a transactional DDL.
+  $txn1 = db_transaction();
+
   // Delete stray entries from the Webform tables before adding serial numbers.
   db_query("DELETE FROM {webform_submissions} WHERE nid NOT IN (SELECT nid FROM {webform})");
   db_query("DELETE FROM {webform_submitted_data} WHERE nid NOT IN (SELECT nid FROM {webform})");
 
-  // Postgres has a transactional DDL.
-  db_transaction();
-
   // Add next_serial column to webform.
   $spec = array(
     'description' => 'The serial number to give to the next submission to this webform.',
@@ -1809,7 +1809,7 @@ function webform_update_7416() {
   // Add serial numbers to all submissions.
   // MySQL COMMITs transactions when it encounters a DDL change, so start the
   // transaction. In Postgres transactions will nest, which is fine.
-  db_transaction();
+  $txn2 = db_transaction();
 
   // Repeat for every Webform.
   $nids = db_select('webform', 'w')
diff --git a/webform.module b/webform.module
index 6027bbf..950f159 100644
--- a/webform.module
+++ b/webform.module
@@ -4660,16 +4660,14 @@ function webform_date_views_extra_tables() {
 function _webform_submission_serial_next_value($nid, $do_increment = TRUE) {
   // Use a transaction with SELECT ... FOR UPDATE to lock the row between
   // the SELECT and the UPDATE, ensuring that multiple Webform submissions
-  // at the same time do not have duplicate numbers.
-  // Do not lock unless incrementing.
-  if ($do_increment) {
-    db_transaction();
-  }
+  // at the same time do not have duplicate numbers. FOR UPDATE must be inside
+  // a transaction.
+  $txn = db_transaction();
 
   // Get the next_serial value.
   $next_serial = db_select('webform', 'w')
-    // FOR UPDATE does not lock outside of a transaction.
-    ->forUpdate()
+    // Only add FOR UPDATE when incrementing.
+    ->forUpdate($do_increment)
     ->fields('w', array('next_serial'))
     ->condition('nid', $nid)
     ->execute()
