Steps to reproduce:

1) Create a pager query using printf() syntax for the select_expr:

pager_query('SELECT %s FROM {%s}', 5, 0, NULL, $myexpression, $mytable)

Result:

The COUNT() query in pager_query shifts all the printf() arguments over by one place. Results in standard MySQL syntax error message: "user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use..."

Expected result:

The COUNT() query would successfully use printf() on the entire query.

Potential cause:

The COUNT query is not created with printf() in mind for the select_expr:

pager.inc
65: $count_query = preg_replace(array('/SELECT.*?FROM /As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM ', ''), $query);

Comments

chx’s picture

Status: Active » Closed (won't fix)

Provide your own count_query if you are doing weird stuff.

deekayen’s picture

Status: Closed (won't fix) » Closed (duplicate)