Getting this error message:
'Exception: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'
in views_plugin_query_default->execute() (line 1212 of /var/www/new/sites/all/modules/views/plugins/views_plugin_query_default.inc).
One thought: in views_handler_filter_comment_user_uid.inc, the line:
$subselect = db_select('comments', 'c');
might need to read:
$subselect = db_select('comment', 'c');
but that still doesn't solve the problem.
This is present in a stock install with just views enabled with today's dev version of views 7. Drupal base is rc2.
This is the reported SQL output in the view:
SELECT node.nid AS nid FROM {node} node WHERE ((( (node.uid IN ('1')) OR (0 < SELECT COUNT(*) AS expression FROM (SELECT c.cid AS cid, 1 AS expression FROM {comments} c WHERE (uid IN ('1')) AND (nid = :db_condition_placeholder_1) ) subquery) )))
This may be related to #972934: Contextual filter "Content: User posted or commented" argument does not work
Comment | File | Size | Author |
---|---|---|---|
#21 | fixed_user_posted_or_comment_handler-1006482-20.patch | 2.32 KB | jessebeach |
#18 | fixed_user_posted_or_comment_handler-1006482-18.patch | 2.24 KB | jessebeach |
#9 | screenshot_001.png | 36.19 KB | mstef |
#2 | 1006482-filter_user_posted.patch | 4.85 KB | dawehner |
Comments
Comment #1
dawehnerThis is definitive related. The code has to changed like in the argument handler.
The problem is this line from my perspective. Placeholders have problem when they are part of the subquery.
Comment #2
dawehnerHere is a patch for this issue.
Seems to be somehow now the same.
Comment #3
dawehnerAs always the request is there but no will to test the patch. That's sad.
Commited to git.
It's hosted on https://github.com/ksenzee/views3ui until the new ui is in.
Comment #4
neopoet CreditAttribution: neopoet commentedDereine,
Thanks for your work on this.
Andrew
Comment #6
webmasterkai CreditAttribution: webmasterkai commentedReopening. I closed #1235724: user posted or commented filter doesn't seem to work as a duplicate of this issue.
Steps to reproduce:
In other words, add the following to any view.
Example of the the sql as a result of the above committed patch
As can be seen in the SQL above "WHERE (uid in Array) " is the problem. Unfortunately, I'm not sure if this pertains to #1112854: Subqueries use wrong arguments or not. Perhaps dereine can provide some input on this.
Comment #7
webmasterkai CreditAttribution: webmasterkai commentedComment #8
a.ross CreditAttribution: a.ross commentedsub
Comment #9
mstef CreditAttribution: mstef commentedI'm getting this error (see attached), and strange timestamp in a dsm. Patch doesn't seem to fix it.
Comment #10
mstef CreditAttribution: mstef commentedError seems to stem from (views_handler_filter_comment_user_uid.inc):
Here's the bad query generated:
Looks like it's assuming $this->value is a string/int, but it's an array.
Comment #11
mstef CreditAttribution: mstef commentedI'm thinking that
Should be
Comment #12
Letharion CreditAttribution: Letharion commentedComment #13
xanderol CreditAttribution: xanderol commentedI'm not getting any errors but it seems the filter stops working as soon as a user comments on something.
The filter seems to work fine as long as a user has no comments but as soon as they comment on something the filter breaks and shows all nodes regardless of who created them or commented on them.
I'm using the latest Dev and Drupal 7.8 with the default Tracker view.
I also tried on a fresh install.
Comment #14
mstef CreditAttribution: mstef commentedMaking the change from #11, brings us a new sql error:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 'SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM comments c WHE' at line 1
Comment #15
mstef CreditAttribution: mstef commentedAnother issue, is that the table that stores comments is "comment", not "comments".
Comment #16
JustMagicMaria CreditAttribution: JustMagicMaria commentedSubscribing.
Comment #17
couturier CreditAttribution: couturier commentedLooking forward to seeing a fix for this. My whole front page depends on it. I'm not a programmer, but if I can help test anything, let me know. Thanks.
Comment #18
jessebeach CreditAttribution: jessebeach commented@couturier, can you test this patch?
Rather than a subquery inside a condition on the original query, this patch adds a join of the comment table on the base table. The SQL (without any other filters) looks like this
Essentially we're saying that if the comment table has any rows with an nid field value the same as an nid in the node table, then include the nodes in the result set (but don't ignore any nodes without comments because of the left join) on the condition that those selected comments were written by the users specified in the set :uids or if the nodes were authored by the users in the set :uids. I hope that sentence makes sense!
Thanks to @soyarma for walking through the SQL with me and explaining what a LEFT JOIN is!
Comment #19
tim.plunkettShould be
new views_join()
.Needs spaces after quotes.
Without interpolation, no real need for the double quotes. Should be single quotes.
Otherwise, looks pretty good.
Comment #20
DamienMcKennaMinor clarification on @tim.plunkett's comment:
This needs spaces after the commas, not the quotes.
Comment #21
jessebeach CreditAttribution: jessebeach commentedThanks @tim.plunkett
Updated with the corrections.
Comment #22
couturier CreditAttribution: couturier commentedMy test sites are all down currently due to a hosting issue. This has happened only twice in a year and a half due to switching sites over to a completely new server, and I'm waiting on tech support, so that's the only delay. I'll report back on the testing as soon as I can, unless anyone else gets to doing it before I'm able. Thanks jessebeach and tim.plunkett!
Comment #23
couturier CreditAttribution: couturier commentedMy hosting is still in transition, but I managed to slip in and apply the patch to one of the sites for testing. Works perfectly now! I'm new, so not sure what to do next. Do we do something special to report this fix for the next Views version release?
Comment #24
a.ross CreditAttribution: a.ross commentedOh that's good news! I'll test the patch myself later to confirm it.
You don't have to do anything beyond this, but it might speedup the process to go into the #drupal-contribute IRC channel to ping merlinofchaos (or another maintainer). If I find time this week I'll do it myself.
Comment #25
dawehnerOkay rc3 is out which has fixed this specific part. Sadly i couldn't response on that issue.
In general this patch would have not worked because it would have joined the comment table, so creates duplicates.
Comment #26
a.ross CreditAttribution: a.ross commentedVery nice