Alchemy is generating PostgreSQL errors on Drupal sites running PostgreSQL. The problem is that some queries are using double quotes(") to quote strings within the query. In PostgreSQL, double quotes are used to quote columns (e.g. in cases where a column name is the same as a reserved word), and only single quotes(') are used to quote strings. Best practice is to use double quotes to delimit the string containing a SQL query, and single quotes to delimit actual strings within the query. E.g., do

$sql = "DELETE FROM {alchemy_cache} WHERE nid = %d AND command = '%s' ";

not

$sql = 'DELETE FROM {alchemy_cache} WHERE nid = %d AND command = "%s'" ';

This will be compatible with both MySQL and PostgreSQL.

Patches to follow in the comment.

Comments

ben coleman’s picture

Attached are patches for the above problem. The first is against 6.x-1.0-rc6, for anyone who needs to patch against the current release. The second is against 6.x-1.x. This changes quoting on SQL queries so that the query is enclosed in double quotes("), and strings within the query are enclosed in single quotes(').

ben coleman’s picture

Status: Active » Needs review
technologywon’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 is no longer supported