Hi,

 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''') AND (. IN ('')) ORDER BY left(trim(LEADING 'het ' FROM (tri query: views_alpha_pager_views_query_alter SELECT DISTINCT left(trim(LEADING 'het ' FROM (trim(LEADING 'de ' FROM (trim(LEADING 'een ' FROM (trim(LEADING 'and ' FROM (trim(LEADING 'the ' FROM (trim(LEADING 'a ' FROM (trim(LEADING '\'' FROM (trim(LEADING '"' FROM (trim(LEADING ' ' FROM (upper(node.sticky))))))))))))))))))), 1) FROM node node WHERE (. '') AND (. IN ('')) ORDER BY left(trim(LEADING 'het ' FROM (trim(LEADING 'de ' FROM (trim(LEADING 'een ' FROM (trim(LEADING 'and ' FROM (trim(LEADING 'the ' FROM (trim(LEADING 'a ' FROM (trim(LEADING '\'' FROM (trim(LEADING '"&#0 in

The part WHERE (. '') AND (. IN ('')) is troublesome.
AFAIKS it is caused by an arronous use of $query->add_where($clause), somewhere along the line the args are 'lost'.

Comments

douggreen’s picture

It appears that like the views WHERE arguments aren't being properly used.

Can you confirm that it's this query on line +150 that's causing the problem?

  $result = db_query($countquery, $query->where_args);

If you print_r($query->where_args) do these look right?

This could be

  1. a problem with the query and not VAP, please confirm that you don't get this error with the default numeric pager
  2. caused by improper handling of arguments, are you using views arguments?
  3. I have this identical problem in VFS (views_fastsearch) development version right now. There are notes about it on the release notes page. Are you using VFS?
  4. I can't see the entire SQL string because the junk word filters makes the SQL string long and the Drupal error message is truncated at a certain length. It will be easier to diagnose the bad SQL if you remove the junk words on admin/settings/views_alpha_pager, this will remove the TRIM(LEADING ... FROM ...) SQL functions
douggreen’s picture

Title: Qeury WHERE broken » Query WHERE broken
jenlampton’s picture

Version: 5.x-1.x-dev » 5.x-1.1

I'm having the same problem with this module...
Here are my resutls for print_r($query->where_args):

Array ( [0] => node [1] => type [2] => listing ) 

To answer your other questions...
1) I do not get this problem with the default, numeric, pager.
2) I am not using arguments.
3) I am not using views_fastsearch, but I will check their notes about this error.
4) here is the error message, with junk filters removed:

user warning: Unknown column 'node_title' in 'group statement' query: SELECT DISTINCT left(upper(node.title), 1) FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_data term_data ON term_node.tid = term_data.tid WHERE (node.type IN ('listing')) GROUP BY node.nid, node_title ORDER BY left(upper(node.title), 1) in /home/shared/cityofec/drupal/includes/database.mysql.inc on line 172.

Jen

jenlampton’s picture

Aha!

I removed the filter "Node: Distinct" and the error disappeared, but the where clause output didn't change:

Array ( [0] => node [1] => type [2] => listing )

I'm not sure how that filter is usually handled, but maybe it's not dealt with correctly in this module?

Jen

douggreen’s picture

Status: Active » Closed (won't fix)

The DISTINCT views filter causes all sorts of problems with the way Drupal handles query rewrites. Avoid it unless you really need it.