pager_query() misses multi.line SELECT\tab\FROM\tab.. SQL-Strings
spiffl - July 30, 2007 - 15:19
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | base system |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
I've wondered why pager_query() returned me 41 results, when there were only 36 nodes in the table.
Reason: db_result in combination with a multi-line SQL string misses to match a query (see below) that contains tabs or newlines.
$query = "
SELECT
n.nid,
n.title,
n.uid,
n.type,
n.status,
n.created,
u.name AS username
FROM
{node} n
...
";
The attached patch properly checks for whitespace instead of space-character and matches also the above query.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| pager_count-query-matching.diff.txt | 800 bytes | Ignored | None | None |

#1
Tested on pager.inc revision 1.62, and indeed the sql query on different lines returned only the first page of 10 nodes, instead of 4 pages of 35 nodes.
Applying the patch produced the correct results.
#2
Why do we restrict the ORDER BY to work with spaces only then?
#3
Now a duplicate of #288837: Pager.inc regexp misses whitespace use case, even if this one is older.