Problem/Motivation

Running the update 6200 of the service_links module versions 6.x-2.x results in a database error when using PostgreSQL as the database backend and thus may leave some of the module's variables intact instead of deleting them appropriately.

The error is as follows:

warning: pg_query(): Query failed: ERROR: column "service_links_show_" does not exist LINE 1: SELECT name FROM variable v WHERE LOCATE("service_links_show... ^ in DRUPAL_ROOT\includes\database.pgsql.inc on line 138.

user warning: ERROR: column "service_links_show_" does not exist LINE 1: SELECT name FROM variable v WHERE LOCATE("service_links_show... ^ query: SELECT name FROM variable v WHERE LOCATE("service_links_show_",v.name) > 0 in DRUPAL_ROOT\sites\all\modules\service_links\service_links.install on line 47.

Proposed resolution

Since LOCATE() is not a standard function (and is not included in PostgreSQL), its usage should be substituted with a more standards-compliant solution.

Additionally, the usage of double quotes around string literals is also not standards-compliant and is broken under PostgreSQL.

This way, the line

$result = db_query('SELECT name FROM {variable} v WHERE LOCATE("service_links_show_",v.name) > 0');

should be

$result = db_query("SELECT name FROM {variable} v WHERE v.name LIKE '%service_links_show_%'");

in the function service_links_update_6200() in the file service_links.install.

Remaining tasks

A proposed patch is attached to my comment. It's tested (and working) against 6.x-2.x-dev.
A similar solution should be merged to the 6.x-2.x codebase.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kaszam’s picture

Jibus’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed, i have this error also but on D7 (weid because updates names 62xxx).