? cvs_get_vanilla.sh Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.494 diff -u -p -r1.494 common.inc --- includes/common.inc 30 Nov 2005 10:27:13 -0000 1.494 +++ includes/common.inc 30 Nov 2005 22:00:04 -0000 @@ -453,6 +453,8 @@ function drupal_http_request($url, $head * 1 = Log errors to database and to screen. */ function error_handler($errno, $message, $filename, $line) { + global $drupal_in_transaction; + if ($errno & (E_ALL ^ E_NOTICE)) { $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning'); $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.'; @@ -461,6 +463,16 @@ function error_handler($errno, $message, drupal_set_message($entry, 'error'); } + if (isset($drupal_in_transaction) && $drupal_in_transaction) { + // When in transaction and a query fails, then all following queries + // are ignored untill the transaction is commited or rolled back. + // To prevent this we're rolling back the transaction. + // This can be executed only for PostgreSQL, because MySQL won't set + // the variable + db_query('ROLLBACK'); + $drupal_in_transaction = FALSE; + } + watchdog('php', t('%message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line)), WATCHDOG_ERROR); } } Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.20 diff -u -p -r1.20 database.pgsql.inc --- includes/database.pgsql.inc 29 Nov 2005 20:16:06 -0000 1.20 +++ includes/database.pgsql.inc 30 Nov 2005 22:00:04 -0000 @@ -322,7 +322,13 @@ function db_escape_string($text) { * This function automatically starts a transaction. */ function db_lock_table($table) { - db_query('BEGIN; LOCK TABLE {%s} IN EXCLUSIVE MODE', $table); + global $drupal_in_transaction; + $begin = ''; + if (!$drupal_in_transaction) { + $begin = 'BEGIN; '; + $drupal_in_transaction = TRUE; + } + db_query($begin .'LOCK TABLE {%s} IN EXCLUSIVE MODE', $table); } /** @@ -330,7 +336,11 @@ function db_lock_table($table) { * This function automatically commits a transation. */ function db_unlock_tables() { - db_query('COMMIT'); + global $drupal_in_transaction; + if ($drupal_in_transaction) { + db_query('COMMIT'); + $drupal_in_transaction = FALSE; + } } /**