Hi there,
I've searched the forums but nothing seems to quite explain the errors i'm getting after i upgraded views. I'm using all the latest versions of ctools/entity etc. I use panels on various pages of my site and within each panel i use a paged view to show 'teasers' of various content. After I upgraded I went into the view admin and noticed that there was the following error on all but one of the separate views (weirdly the 1 view that is working is identical to the rest) -
The error is : 'Exception: 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 \'LIKE \'example\' ESCAPE \'\\\\\') AND (node.type IN (\'example\')) AND (n\' at line 3' in views_plugin_query_default->execute() (line 1386 of /home/content/all/modules/views/plugins/views_plugin_query_default.inc).
After checking the logs there is also another error that seems to accompany the one above :
'Exception: SQLSTATE[23000]: Integrity constraint violation: 1052 Column \'uid\' in on clause is ambiguous'
in views_plugin_query_default->execute() (line 1386 of /home/content/sites/all/modules/views/plugins/views_plugin_query_default.inc).
The view doesn't produce any results no matter how i change it.
Again apologies if one of the other issues relates to this,
Thanks,
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | sql-query-bug.jpg | 386.17 KB | xiarnousx |
| #12 | views_date_bug.txt | 492 bytes | matmasr |
| #12 | calendar (Content) Peoria Parent - Mozilla Firefox_2011-08-04_19-51-23.png | 30.94 KB | matmasr |
| #12 | view_with_bug.txt | 18.02 KB | matmasr |
| #12 | views_no_bugs.txt | 17.92 KB | matmasr |
Comments
Comment #1
dawehnerIf you create an issue in the views issue queue you will see this text
Before submitting an issue to Views, you are responsible for reading and understanding the Views issue submission guidelines. Failure to read and understand this page will result in your issue being marked "won't fix".
So can you please give us more informations, because even this is cleary a bug, it's impossible to reproduce.
Comment #2
dawehnerUpdate
Comment #3
gc11 commentedOk, so i've done some more research and I believe that this relates to something to do with the taxonomy changes talked about in this post - http://drupal.org/node/1117258.
As requested here is some more information : After upgrade of views all views which used taxonomy terms stopped working, the relationship "Content: Taxonomy terms on node" had been added automatically however there were no results being produced and the above errors were being shown. For a test I then took out all filters and the view still did not produce results, it came up with errors saying "no values found" - even though this should have produced a view of all content on the site, on the preview it tells me that it is 'unable to preview due to validation errors'. And it won't let me save the changes. I've included an export of the view with one of the displays both for the original view with the filters and relationship added automatically and for the display after i had taken off all filters and relationsips where it still returned no results and there was a validation error.
original view after update
view with no filters which still does not show content
After this I thought that maybe this view and all of its displays may have become corrupt somehow so I set up a new view, with a one page display, added the relationship "Content: Taxonomy terms on node" and also a filter as "published=yes and (term) Taxonomy term: Name" There is also the normal descending sort criteria. After saving this display results do appear but when viewing the page I am still shown the debug notice "'Exception: SQLSTATE[23000]: Integrity constraint violation: 1052 Column \'uid\' in on clause is ambiguous' in views_plugin_query_default->execute() (line 1386 of /home/views/plugins/views_plugin_query_default.inc)."
I've included an export of this new view also.
I don't know if this is helpful at all,
Views version is 7.x-3.x-dev
Core : 7.4
Thanks for your help,
Comment #4
yan commentedI'm getting this error in Views 7.x-3.x-dev in a date browser view:
Additionally a number (like a timestamp) is displayed in a green box on every page load in the views admin.
Comment #5
merlinofchaos commentedyan: I believe your issue is a date.module bug.
Comment #6
moonray commentedsame issue...
This happened after an update to a more recent version of views from 2011-06-09 to 2011-08-02.
Error message:
EDIT:
Additional info...
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 '= '96' ) ))) subquery' at line 2EDIT 2:
This is what the SQL statement looked like before the upgrade:
Comment #7
moonray commentedAnd I've got a second error on a different view. Looks like it might have to do with table prefixes not being applied to the query properly anymore?
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'uid' in field list is ambiguousComment #8
moonray commentedFollowing up... my view has the following:
• CONTEXTUAL FILTERS: User: Uid
• RELATIONSHIPS: Content: Author
However, User: Uid was set to not use the relationship with Content: Author. After the update that option is no longer available... the relationship HAS to be set. As soon as you do that, the errors go away.
Comment #9
moonray commentedIt seems
RELATIONSHIPS: Content: Authornow needs to be added to views (it's no longer implied), where before it didn't. This seems to be the main problem with every view I encounter having these errors.Comment #10
dawehnerThat's true, that's a design change which was intended.
Additional there is some update code involved to automatically add a relationship for the author, which works for the most people.
@moonray
Can you try to reproduce this issue so we can reproduce it?
It would require a view export without the relationship. Once it reproducable it's a high chance that it can be fixed.
Comment #11
merlinofchaos commentedDo you have an export of the view that was failing? The relationship update code was supposed to fix that, but apparently did not. I'm curious why not.
Comment #12
matmasr commentedI have a similar issue with views, date and calendar module. I can't tell if it is a Views issue or a Date module issue. I recently upgraded my site from D5 to D6 to D7. I am using Views-7.x-3.0-rc1 and Date module 7.x-2.0-alpha3 and Calendar module 7.x-2.0-alpha1
I have a custom content type that includes a DATE CCK field called "Family event". When I modify the standard Calendar View to replace the argument (Contextual Filter) to my custom field
Contextual filters
Date: Date (node) (Content: Event Date and Time (field_family_event_date)).
instead of
Contextual filters
Date: Date (node) (Content: Updated date)
I get this error attached below in the txt and image files.
I assumed it was a Views bug since the error message states that
Comment #13
xiarnousx commentedI had sql error issue under 7.x-3.0 rc1
I think this bug relates to how strings are being processed when building up the query.
I only ,so far, had this issue when using string comparison operators such is is equal , is not equal, contains... and input filed labeled value. for your convenience i added snap shot of the error.
Thanks
Comment #14
DeNelo commentedI get it too.
Error:
The view is restricted to show content of one content type. Exported view:
My taxonomy is multi-level; I use Content Taxonomy for tagging content with multi-level taxonomies.
Comment #15
dawehner@all
Did you tryed to add a certain relationship? For example if you have user: uid use the node: author relationsip, or if you have something with taxonomy terms use content: taxonomy terms.
Comment #16
max.ricketts commentedThis error is easy to reproduce on a clean Drupal 7.8 installation with only ctools and views installed. Trying to add various filter criteria will trigger the error.
For example, with the latest (dev or recommended) releases of ctools and views, trying to add a filter criteria for "User posted or commented" will produce the following:
"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 'Array) AND (nid = node.nid) ) subquery)) OR (0 < SELECT COUNT(*) AS expression F' at line 1"
I am a Drupal/Views novice; I'm simply trying to add a view to filter by article author (while working through Chapter 3 of The Definitive Guide to Drupal 7) and am unable to due to this error. I do not have the date/calendar modules installed.
Comment #17
tboornaz commentedI seem to get the error when I filter based on User: Authentication name and I use an operator and value to filter to a specific user. I have used the filter criteria with an operator and value for NID and taxonomy term and I do not seem to get the error then.
Comment #18
dawehnerYou should just use the node: author relationathip. User: authentication name shouldn't be there.
@max.ricketts
This error is easy to reproduce on a clean Drupal 7.8 installation with only ctools and views installed. Trying to add various filter criteria will trigger the error.
If it's that easy then describe which ones. I use views on daily base and this error didn't appeared yet. Perhaps you should also update to the latest dev version.
Comment #19
rctipton21 commented@max.ricketts: I had the same issue when reading the book. Check this suggestion posted on the book's website: http://definitivedrupal.org/suggestions/problem-adding-username-view-filter
Comment #20
Morn commentedAfter examining the content types involved in the error Views (mainly with date module fields) I saw that the error came as a result of the content type migration (d6-d7), except in one case, where the node statistics caused the error.
So I simply corrected the afflicted content types (minor corrections, there was no loss of data) and deleted an created again the View pages with errors (not all pages of the erroneous Views had this error) my problems disappeared.
Comment #21
moonray commented@Morn: don't 'subscribe'... use the new follow button at the top of the page!
Comment #22
alcroito commentedI can confirm that if I add a 2 simple filters
Content: Type (= Event)
Content: Published (Yes)
The view sometimes works ok, sometimes it throws this error. For some reason it is random, and you have to refresh a couple of times to get the error.
'Exception: 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 \'FROM
node node
WHERE (( (node.status = \'1\') AND (node.type IN (\'event\')) ))
LI\' at line 1'
and also the following warning
Warning: Invalid argument supplied for foreach() in views_plugin_query_default->compile_fields() (line 1070 of /var/www/artinfo/sites/all/modules/contrib/views/plugins/views_plugin_query_default.inc).
While debugging the code, I saw that $this->fields is empty, and that's why compile_fields() throws a warning.
Upon investigating the full constructed query, it misses the fields part entirely.
So the query gets to look like
SELECT
FROM node
WHERE .....
with nothing in between SELECT and FROM.
What would cause such a problem?
Comment #23
dawehner@ Placinta
Could it be that you updated calendar? If yes please read the frontpage of the calendar module.
Comment #24
kevinwalsh commentedI was filtering by a taxonomy term named "drawing", which was stored in a field called "field_tags".
I was able to fix this by removing filters such as "Taxonomy term: Name (= drawing)" and replacing them with filters like "Content: Tags (field_tags)"
Comment #25
shunting commentedI have the same error a #17 with RC2 with an identical error and the green number (1321245117):
Here is the generated sql:
I'd really like to be able to filter content by author.
Comment #26
merlinofchaos commented#25: Your problem is a known bug in core with subqueries losing their arguments, I believe. There's an issue for that somewhere. Search the drupal core queue for subquery db_select and argument -- I think those 3 terms should find it.
Comment #27
dawehnerMark this issue as fixed as some of the problems mentioned in this issue is already fixed, some maybe not, but please create ALWAYS new issues. It's kind of easier to mark new ones as duplicates than getting multiple information out of a single issue.
Comment #29
jaenalexander commentedHey I don't know if this info is useful at this time but I resolve this issue activating ajax to 'Yes' in the view for the respectevily display, that let me use exposed filters with "Contains all words" Maybe is not a full solution but it works.
Views version 7.x-3.1