Download & Extend

PostgreSQL compatibility - invalid quote format in taglist.load.inc :207

Project:Inline and link Drupal objects (Linodef)
Version:6.x-1.x-dev
Component:Taglists
Category:bug report
Priority:minor
Assigned:Unassigned
Status:needs review

Issue Summary

Line 207 of taglist.load.inc reads:

<?php
$result
= db_query('SELECT n.nid FROM {node} n WHERE n.type = "%s" order by n.%s %s', $contenttype, $tl_properties['sort_method'], $tl_properties['sort_sequence']);
?>

As per: http://drupal.org/node/2497
In database queries, "Any string literal or %s placeholder must be enclosed by single quotes: ' . Never use double quotes."

One reason for this (there may be others?) is that PostgreSQL reserves double quotes in a query string for abnormal table / column names
As such this query fail with a "column not found" error on PgSQL.

For readability sake, typically the logical choice is to switch the quoting of the db_query string and its string literal arguments.

This seems to work fine in testing in a PgSQL environment:

AttachmentSize
linodef-taglists-pgsql_quoting-1.patch1.18 KB