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.
Comment | File | Size | Author |
---|---|---|---|
#1 | service_links-update_6200_variable_delete_under_postgresql-2191539-1-D6.patch | 535 bytes | kaszam |
Comments
Comment #1
kaszam CreditAttribution: kaszam commentedComment #2
Jibus CreditAttribution: Jibus commentedConfirmed, i have this error also but on D7 (weid because updates names 62xxx).