When using a table view and exposing a few filters and use minimum 2 of them I receive the following error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /views/ajax
StatusText: Internal Server Error
ResponseText: PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens: SELECT COUNT(*) AS expression
FROM 
(SELECT 1 AS expression
FROM 
{node} node
LEFT JOIN {taxonomy_index} taxonomy_index ON node.nid = taxonomy_index.nid
LEFT JOIN {taxonomy_term_data} taxonomy_term_data ON taxonomy_index.tid = taxonomy_term_data.tid
LEFT JOIN {field_data_apk_build_time} field_data_apk_build_time ON node.nid = field_data_apk_build_time.entity_id AND (field_data_apk_build_time.entity_type = :views_join_condition_0 AND field_data_apk_build_time.deleted = :views_join_condition_1)
WHERE (( (node.type IN  (:db_condition_placeholder_0)) AND (node.title ILIKE :db_condition_placeholder_1 ESCAPE '\') AND (taxonomy_term_data.name ILIKE :db_condition_placeholder_2 ESCAPE '\') ))) subquery; Array
(
[:db_condition_placeholder_0] => apk
[:db_condition_placeholder_1] => %acf%
[:db_condition_placeholder_2] => x86
[:views_join_condition_0] => node
[:views_join_condition_1] => 0
)
in views_plugin_pager->execute_count_query() (line 140 of /var/www/localhost/htdocs/drupal/sites/all/modules/views/plugins/views_plugin_pager.inc).

I am using a custom node type with multiple fields created with Field API. My database is PgSQL.
Attached is the view as it is currently running on: http://alpinelinux.org/packages . I have also tried creating a simpler table view with only 2 fields and 2 exposed filters, but this gives the exact same error. Attached you kind find the exported view.

CommentFileSizeAuthor
views.txt33.2 KBclandmeter

Comments

esmerel’s picture

hm. I'm unable to replicate this on a mysql database with the latest dev. I wasn't able to use the export, but creating my own doesn't break this.

merlinofchaos’s picture

Status: Active » Closed (duplicate)

There's a subquery in there. There's currently a bug in core where subqueries lose their parameters when used on multiple queries. You can work around this by disabling the pager, which isn't an ideal solution, I know.

http://drupal.org/node/1112854

merlinofchaos’s picture

Status: Closed (duplicate) » Active

Hm. I am misreading. There isn't another subquery in there.

dawehner’s picture

I don't really get it 100%. There are 5 placeholders in the sql query and 5 queries at the end.

clandmeter’s picture

I just tried a clean setup with D7.0 Latest Views from git 7.x. But the issue still remains.

PHP version 5.3.6
PgSQL version 9.04

dawehner’s picture

If it works fine on mysql this seems to be like an dbtng issue for me

@clandmeter
Do you have an idea how to reproduce this issue with a pure dbtng php code? This would help the database maintainers to reproduce the problem.

merlinofchaos’s picture

Yeah, I think this is a core DBTNG bug probably.

merlinofchaos’s picture

Status: Active » Closed (won't fix)