I'm setting up a view using a relationship with the flag module. The goal is to create a view of nodes that a specific user flagged.
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/ajax/preview/user_likes
StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'uid' in on clause is ambiguous: SELECT COUNT(*) AS expression
FROM
(SELECT node.title AS node_title, node.nid AS nid, 1 AS expression
FROM
{node} node
LEFT JOIN {users} users_flag_content ON uid = users_flag_content.uid
WHERE (( (node.status <> :db_condition_placeholder_0) AND (users_flag_content.uid = :db_condition_placeholder_1) ))) subquery; Array
(
[:db_condition_placeholder_0] => 0
[:db_condition_placeholder_1] => 1
)
in views_plugin_pager->execute_count_query() (line 141 of /.../sites/all/modules/contrib/views/plugins/views_plugin_pager.inc).
The left join here "LEFT JOIN {users} users_flag_content ON uid = users_flag_content.uid" doesn't use node.uid as it should.
Any ideas?
- Scott
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | view.txt | 4.88 KB | mstef |
| #4 | like_feature_test.tar_.gz | 1.51 KB | hadsie |
| #4 | like_flag.txt | 760 bytes | hadsie |
| #2 | likes_view.txt | 4.19 KB | hadsie |
Comments
Comment #1
dawehnerCan you please export the view?
In general this looks like a problem of the flag module in d7.
Comment #2
hadsie commentedYeah, it's quite possible it's an issue with flags. I wasn't sure though... the view is attached...
Comment #3
dawehnerCan you please provide a flag export, too?
To be able to fix this bug it's required to reproduce the bug :)
Alternative a feature (from the features module) is required.
Comment #4
hadsie commentedOf course, sorry :). Here's a feature with the view and the flag, and also the flag export by itself (just for good measure).
Comment #5
hadsie commentedAny ideas on whether this is a views or a flag issue?
Comment #6
dawehnerCan you test whether this still happens with the latest version of views (dev) ?
There was a lot of fixes recently.
Comment #7
hadsie commentedUpdated to the latest versions of Drupal, Views, and Flag and I'm still getting the exact same error message :/.
Where you not able to reproduce the issue with the attached code?
Thanks!
Scott
Comment #8
iamjon commentedhadsie,
I installed your feature, what do I have to do to replicate the error? Please provide step by step instructions.
Comment #9
palik commentedsubscribing,
I think I have similar issue.
1) I created a new type of content - an meeting,
2) I created a a flag "i'll be there" so an user can confirm that he/she will be attending,
3) I created a view "who flagged a node", with relationship between nodes and users, with id of node as argument,
4) When I add "user name" and "user email" - everything works perfect - I get names and mails of users who flagged a meeting.
5) when I add "bio" or any other field that I created in users - I receive 0 results. Sometimes I receive an strange error - nearly a blank page with whole view definition in one very long line.
Comment #10
dawehnerThe replication is really the main thing here. Without a reproducable bug it's impossible to fix this, perhaps, existing bug.
Here it would also help if you could enable display of php errors
Comment #11
hadsie commentedOk, I've been able to resolve the issue here. I believe it was ultimately an issue with the flag module, it let me select the "flag: user" relationship without selecting the necessary 'Flags: flag_name' relationship as well. The module seems to not allow that anymore and I can build the view with no errors. Thanks for your guys' time in looking into this one!!
- Scott
Comment #13
mstef commentedGetting this with the latest dev on a comment view using relationship comment:content and comment:user.
Error message: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'uid' in field list is ambiguous
See attached view
Comment #14
mstef commentedPretty obvious problem in the query:
Comment #15
merlinofchaos commentedWhile I don't know why this happened, the problem is here:
That field does not have a relationship, meaning it's trying to work from the base relationship. It *should* be auto-adjusting to use the user relationship, but maybe somehow that's failing. Edit the view, edit that field, and ensure it's selecting the correct relationship. Then choose 'update' on that field (Regardless of whether it appeared to have the correct value or not) and try previewing the view to see if the query is updated.
If that doesn't, check all of the user: fields for the same thing.
Comment #16
mstef commentedAh.. that did work. Good call. I wonder why the relationship wasn't automatically selected (like the other fields were).
Thanks
Comment #17
merlinofchaos commentedThat part seems like it is still a bug and should be explored.
For example, can you create a new view similarly and still have this problem?
Comment #18
mstef commentedhm.. can't seem to get it to happen again.
Comment #19
fietserwinSeems like a duplicate of #1309142: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'vid' in field list is ambiguous (or the other way around, but that issue is more generic and has more information)?