API page: http://api.drupal.org/api/drupal/includes%21update.inc/function/update_f...

Enter a descriptive title (above) relating to update_fix_d7_block_deltas, then describe the problem you have found:

I am running Postgres 9.0.4, Apache/2.0.64 (Unix) PHP/5.3.5 DAV/2

In updating from Drupal 7.2 to 7.14 I received this error when menu_update_7002 executes.
It's the "ILIKE" that is causing the problem. When I trace through the code I can see "LIKE" which is in the condition array changed to "ILIKE" in the "stringVersion". The database query executes ok if LIKE is used.

PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: bytea ~~* unknown LINE 4: WHERE (uid > '-1') AND (data ILIKE '%s:5:"block";%') ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.: SELECT u.uid AS uid, u.data AS data FROM {users} u WHERE (uid > :db_condition_placeholder_0) AND (data ILIKE :db_condition_placeholder_1) ORDER BY uid ASC LIMIT 100 OFFSET 0; Array ( [:db_condition_placeholder_0] => -1 [:db_condition_placeholder_1] => %s:5:"block";% ) in update_fix_d7_block_deltas() (line 426 of /Users/ian/GoMOOS/XAMPP/odp1drupal7/htdocs/includes/update.inc).

I traced it to htdocs/includes/database/select.inc around line 1548 and added this work around.
$query = str_replace('ILIKE', 'LIKE',$query);

Code snippet
// WHERE
if (count($this->where)) {
// There is an implicit string cast on $this->condition.
$query .= "\nWHERE " . $this->where;

// 7-17-2012 Ian's work around
// Tracing through the code.
// 1)Before the implicit string cast above...
// where['condition'][1] = ('data', '%' . db_like(serialize('block')) . '%', 'LIKE')
// 2)After the implicit cast above
// String version
// (uid > :db_condition_placeholder_0) AND (data ILIKE :db_condition_placeholder_1)
// 3)Resulting error
// database error
// ERROR: operator does not exist: bytea ~~* unknown LINE 4: WHERE (uid > '-1') AND (data ILIKE '%s:5:"block";%')
// 4) Ian's bandaid replace ILIKE with LIKE
$query = str_replace('ILIKE', 'LIKE',$query);
}
end code snippet

Comments

marcingy’s picture