Problem/Motivation
testExpressionUpdate
fail: [Other] Line 878 of modules/simpletest/tests/database_test.test:
Number of affected rows are returned.
/**
* Test updating with expressions.
*/
function testExpressionUpdate() {
// Set age = 1 for a single row for this test to work.
db_update('test')
->condition('id', 1)
->fields(array('age' => 1))
->execute();
// Ensure that expressions are handled properly. This should set every
// record's age to a square of itself, which will change only three of the
// four records in the table since 1*1 = 1. That means only three records
// are modified, so we should get back 3, not 4, from execute().
$num_rows = db_update('test')
->expression('age', 'age * age')
->execute();
$this->assertIdentical($num_rows, 3, 'Number of affected rows are returned.' . " num_rows: $num_rows");
Steps to reproduce
With PostgreSQL $num_rows
is 4 so the test fails.
Proposed resolution
Probably backport changes made in #805858: Affected rows inconsistent across database engines