diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-09-30 13:04:36 -0400 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-09-30 13:04:36 -0400 |
commit | 83d850f8e4ee4eb3c76fb9b4cd7d07f6cb558a9c (patch) | |
tree | a85d1f0fc7cf8b4e3d995b15af1c12cd527b1c2a | |
parent | 294e7589598e50f0308f4b6b9b205bd14345976d (diff) | |
download | brdo-83d850f8e4ee4eb3c76fb9b4cd7d07f6cb558a9c.tar.gz brdo-83d850f8e4ee4eb3c76fb9b4cd7d07f6cb558a9c.tar.bz2 |
Issue #1575790 by greg.1.anderson, sun, tim.plunkett, superhenne: Fixed Update #7002 fails on postgres - ILIKE operator on bytea not supported.
-rw-r--r-- | includes/database/pgsql/database.inc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc index 79c16b212..00ed7990e 100644 --- a/includes/database/pgsql/database.inc +++ b/includes/database/pgsql/database.inc @@ -74,6 +74,17 @@ class DatabaseConnection_pgsql extends DatabaseConnection { } } + public function prepareQuery($query) { + // mapConditionOperator converts LIKE operations to ILIKE for consistency + // with MySQL. However, Postgres does not support ILIKE on bytea (blobs) + // fields. + // To make the ILIKE operator work, we type-cast bytea fields into text. + // @todo This workaround only affects bytea fields, but the involved field + // types involved in the query are unknown, so there is no way to + // conditionally execute this for affected queries only. + return parent::prepareQuery(preg_replace('/ ([^ ]+) +(I*LIKE|NOT +I*LIKE) /i', ' ${1}::text ${2} ', $query)); + } + public function query($query, array $args = array(), $options = array()) { $options += $this->defaultOptions(); |