Closed (fixed)
Project:
Event Views
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2006 at 06:03 UTC
Updated:
12 Jul 2006 at 23:15 UTC
Hi i just installed this module on my drupal 4.7.2 and used it for creation of a custom page for my event type taxonomy term. After configuration of that particular view when i see the page e.g. http://www.website.com/drupal/taxonomy/term/4/9 it gives these error, when i am logged in as admin.
Warning: 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 'DISTINCT(node.nid) = term_node.nid LEFT JOIN event event ON nod query: SELECT count(*) FROM node node LEFT JOIN term_node term_node ON DISTINCT(node.nid) = term_node.nid LEFT JOIN event event ON node.nid = event.nid WHERE (node.status = '1') AND ((term_node.tid = '4')) AND (DAY(from_UNIXTIME(event.event_start)) >= DAY(from_UNIXTIME(1149746012))) in /home/user/public_html/drupal/includes/database.mysql.inc on line 120
Warning: 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_UNIXTIME(event.event_start)) >= DAY(from_UNIXTIME(1149746 query: SELECT DISTINCT(node.nid), node.title AS node_title, node.changed AS node_changed, event.event_start AS event_event_start, event.timezone AS event_timezone FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN event event ON node.nid = event.nid WHERE (node.status = '1') AND ((term_node.tid = '4')) AND (DAY(from_UNIXTIME(event.event_start)) >= DAY(from_UNIXTIME(1149746012))) ORDER BY event.event_start ASC LIMIT 0, 60 in /home/user/public_html/drupal/includes/database.mysql.inc on line 120
and when i am anonymous
Warning: 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 'DISTINCT(node.nid) = term_node.nid LEFT JOIN event event ON nod query: SELECT count(*) FROM node node LEFT JOIN term_node term_node ON DISTINCT(node.nid) = term_node.nid LEFT JOIN event event ON node.nid = event.nid INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = -1 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'simple_access') OR (na.gid = 7 AND na.realm = 'simple_access') OR (na.gid = 1 AND na.realm = 'term_access') OR (na.gid = 4 AND na.realm = 'tac_lite') OR (na.gid = 6 AND na.realm = 'tac_lite') OR (na.gid = 5 AND na.realm = 'tac_lite') OR (na.gid = 1 AND na.realm = 'tac_lite') OR (na.gid = 3 AND na.realm = 'tac_lite') OR (na.gid = 2 AND na.realm = 'tac_lite') OR (na.gid = 0 AND na.realm = 'tac_lite'))) AN in /home/user/public_html/drupal/includes/database.mysql.inc on line 120
Warning: 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_UNIXTIME(event.event_start)) >= DAY(from_UNIXTIME(1149746 query: SELECT DISTINCT(node.nid), node.title AS node_title, node.changed AS node_changed, event.event_start AS event_event_start, event.timezone AS event_timezone FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN event event ON node.nid = event.nid INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = -1 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'simple_access') OR (na.gid = 7 AND na.realm = 'simple_access') OR (na.gid = 1 AND na.realm = 'term_access') OR (na.gid = 4 AND na.realm = 'tac_lite') OR (na.gid = 6 AND na.realm = 'tac_lite') OR (na.gid = 5 AND na.realm = 'tac_lite') OR (na.gid = 1 AND na.realm = 'tac_lite') OR (na.gid = 3 AND na.realm in /home/user/public_html/drupal/includes/database.mysql.inc on line 120
any idea whats wrong??
regards,
--rafi
Comments
Comment #1
karens commentedYou're using some kind of node access control, maybe more than one (looks like simple access and tac_light). There have been problems with the node access module re-writing the sql in a way that invalidates it.
This is really a views issue, related to one posted earlier. Anyway, I'm going to move this thread over there and see if merlin has any ideas.
Comment #2
karens commentedActually, this is really a node access issue that affects views.
Comment #3
chaos21in commentedHi ,
Thanks for looking into it. But that error only comes when i use/choose any field of event_views module while creating any "view". It was not there before, and views was working perfectly with both simple_access and tac_lite.
Anyway i dont have any in depth knowledge about it, but please let me know if it can solved (maybe temporarly) by removing simple_access module. As evenif it is installed i am not using it. Where as i need event_views module very much. tac_lite i cannt afford to loose, as i need it too.
regards,
--rafi
Comment #4
chaos21in commentedBy the way i am using taxonomy_access module as well..
regards,
--rafi
Comment #5
merlinofchaos commentedKarenS is correct.
At the moment it's basically a bug in Drupal's node_access feature that was, at one time, fixed and then got unfixed somewhere along the way.
Comment #6
karens commentedThe reason you didn't see it until you added an event field into your view is that it only affects date searches that use the FROM_UNIXTIME sql. That means it affects most event fields, filters, and arguments, but it also affects other date fields like some of those that use node and comment dates. It just depends on which fields, filters and arguments you use.
This is going to require a patch for the node access, if anyone can figure out how to get it to behave properly.
Your error should go away if you disable simple access and tac lite, but if that's not an acceptable solution (and I assuming it's not), you're probably stuck until we find a fix for node access.
Comment #7
karens commentedI'm also going through the event views module to see where I can eliminate that sql, but it many cases it is the only way to get the right results.
Comment #8
chaos21in commentedThanks Karen and Merlin for all the info and advise you provided. I just tried disabling simple_access module only , keeping tac_lite as it is and glad to find that it did work. Simple_access presently i am not using as it is not working on my site since i upgraded my drupal from 4.6.0 to 4.7.0. Even if i give view permission to only one group created by simple_access, the page is accessible by everyone. So now it become useless to me. So all role based accesses are working but group based not.
Also i dont know if one of my other problem is also related to this issue, so just let me spell out the problem and i leave it into experts hand to decide what exactly is the problem. The problem is whenever admin (user_id=1) do something which is high privilage activity (which only admin suppose to do), like accessing logs, editing a page, access admin's my account etc...everything works fine except that i get a log message of "access denied" saying the same activity is just tried by an anonymous user (which i am sure is not the case, i confirmed it by many trials).
anyway my problem is temporarly solved by removing simple_access module only, so maybe it will help you figure out what exactly is the problem. Looking forward to have a patch soon..Good luck..and Thanks again for all the efforts and support.
regards,
--rafi
Comment #9
chaos21in commentedNo sorry sorry!! removing simple_access module does NOT "fully" solves the problem as i thought it has. Now what is happening is after doing some trials and errors:
1. if simple_access is there then in which ever field i use event_views module option it gives error
2. When i remove simple_access module, everything works perfectly if i use options of event_views in the fields of "Page=>'View type'", "Fields", "Sort criteria". But when i use event_views options in "Filters" i again start getting mysql warning messages.
i didnt try removing tac_lite module, as it is important for my website.
regards,
--rafi
Comment #10
karens commentedYou could really help us debug this if you say exactly which fields, filters, and arguments worked, and which ones seemed to create errors.
Thanks!!
Comment #11
chaos21in commentedOk here is some trials i conducted with some combinations of fields and options of event_views module in views: (remember i disabled simple_access module only, tac_lite is working)
1. "Page=>View Type" --->Here whichever option i choose, views works.
2. "Fields" --->Here also whichever options i choose, views works
3. "Filters" (when page=>'view type', Fields, sort criteria has event_views modules options) --->"Event start date", "Event End date" worked perfectly...But "Event Start year" gives error:
"Event Start Month" gives error:
"Event Start Day" Gives errors:
4. "Sort Criteria"---> Works perfectly with all event_view options, except the "filter" i mentioned above which gives errors.
--------------------------------------------------------------------------------
If i disable tac_lite module too along with disabling simple_access...and choosing Filter as "Event start year" ...it gives:
If use "Event start month"
if use "Event start day" if gives:
HTH
regards,
--rafi
Comment #12
karens commentedTry something else for me if you would. I can see you are selecting the current date as the filter date. Try one of those filters that isn't working, but set it to some specific month instead of the current date. Maybe it is just the way I handled the current day that is creating problems. If so, that's probably fixable. That's the only thing I can think of that is different between the queries that are working and those that are not...
Comment #13
merlinofchaos commentedWhat's actually going wrong is that node_access is rewriting the LEFT JOIN erroneously, seemingly due to the from_unixtime. When I have some time, I will try to reduce it to fundamentals and submit it as a bug to Drupal, and it may get fixed in a patch release.
KarenS: Since this impacts you and you are more available than I am right now, it seems, if you would like, what I would suggest is this: Get *just* the query that the view generates, or one close enough to trigger the error, and set up a db_rewrite_sql call that can reproduce the results on a stock Drupal with no other modules installed.
Submit that against node.module as a bug.
If you don't, it's fine; I'll get to it when I can. =)
Comment #14
chaos21in commentedHi KarenS, As per your request..
After disabling simple_access, but tac_lite working ...
when i try "Event: Start Year" -"Is Greater Than" - "2006"...The error is:
when i try "Event: Start Month" -"Is greater than" - "August"- ...The error is:
When "Event start day" - "Is greater than" - "26" ...The error is:
Is this what you were looking for? ...if not please explain a little more...
Let me know if you want me to try any other combination of options, will be glad to help, whatever i can.
regards,
--rafi
Comment #15
chaos21in commentedHi,
I have "Devel" module installed, so i know all the mysql queries in bottom of everpage if i want. When i choose "Event: start date"--"Is Greater than"--"2006-08-10 08:30:00" (NOTE that this is a working option field) the mysql query which has "DISTINCT" in the query is:
So this query is working perfectly...I noticed also that there is no query which involves UNIXTIME in this type of field option.
I dont know if my this finding make any difference or help you in anyway, just trying to help whatever i can =).
regards,
--rafi
Comment #16
merlinofchaos commentedI committed a change that I *think* actually works around this; please try the CVS version of views (with views.module v 1.130 or higher, please) and see if that changes anything.
Comment #17
chaos21in commentedHello Merlin,
Sorry for the late reply. I just checked this posting. Thank you for your great effort i just installed the latest version from cvs 1.141 for views module. I tried all the options which were giving error earlier. "Event Start Year" and "Event Start Month" working perfectly along with others, but "Event Start Day" still gives following errors:
regards,
--rafi
Comment #18
chaos21in commentedSince i am still getting errors so i am puting it back as active bug.
--rafi
Comment #19
chaos21in commentedI installed cck module and then found few more default views. Now I am getting more errors in views modules..When using default view "event_date" and "event_calendar" at http://www.website.com/drupal/event/date and when click year "2006" it goes to
http://www.website.com/drupal/event/date/2006 and gives..
http://www.website.com/drupal/event/date/2006/1 gives:
same type of error if i go to event_calendar view.
event_select view gives:
"event_js" view is working fine..
regards,
--rafi
Comment #20
chaos21in commentedHi ,
In the above 3 postings i was still using old version of event_view module. When i tried the latest from cvs yesterday i started geting fatal errors:
--rafi
Comment #21
chaos21in commentedSorry i didnt notice event module also upgraded yesterday so was still using old version. When i tried today with recent event module. Now i am getting only
Warning: Invalid argument supplied for foreach() in /home/website/public_html/drupal/includes/form.inc on line 637
when adding "Event: Start Day" as one of filters while adding in a event type view. and after saving when tried to see the page organised by view, it gives:
regards,
--rafi
Comment #22
karens commentedAre you using the very latest version of views? This might be a bug that was just recently fixed in views (http://drupal.org/node/66928).
Comment #23
yched commentedHave you tried the following :
- empy your cache (for instance by simply re-submitting your 'modules' page, or with devel.module's "empty cache")
- re-save the incriminated view(s), maybe after checking / redefining the "filters" part
Comment #24
chaos21in commentedHi, Just to be sure i downloaded the CVS version of views, event, event_view, cck, modules and upgarded my website successfull again. Deleted catche by both devel module and also submiting the modules page. Used update.php also (latest cvs version). Also upgraded all .inc files in includes directory which are changed in last 2 weeks (that includes form.inc as well). I also deleted all the filters and recreated it. But unfortunately still getting same error.
when used "Event start day" in filter option, even before saving it gives error:
Warning: Invalid argument supplied for foreach() in /home/website/public_html/drupal/includes/form.inc on line 637
after saving when i goto http://www.website.com/drupal/taxonomy/term/4/9
any idea whats wrong.
regards,
--rafi
Comment #25
chaos21in commentedHi,
I think i got the problem and probable solution. I tried the whole sql query in my phpMyAdmin, i.e.
I got the same error message which i was getting on my website , with syntax error at DAY(from_UNIXTIME(event.event_start). I tried some constant values instead of from_UNIXTIME(event.event_start) like '2006-06-27 12:06:06' with a simple query, which is
select DAY('2006-06-27 12:06:06');
i got again sytanx error even in so simple code. Later i tried :
select DAYOFMONTH('2006-06-27 12:06:06');
which worked perfectly. Ironicaly evenif DAY() is a synonym for DAYOFMONTH() according to http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html but its not working the same way. So later i replaces the query to :
which worked perfectly in phpMyAdmin and gave result "2".
HTH
--rafi
Comment #26
chaos21in commentedDAY() is a synonym for DAYOFMONTH() and It is only available as of MySQL 4.1.1, but my MySQL version is 4.0.27-standard, thats why probably its not working.
Can you please correct it so that it works with all versions..
regards,
--rafi
Comment #27
karens commentedLooks like this is an event_views error, so I'm moving this issue. I thought I had checked that I was using terms that worked in early versions of mysql, but I must have missed this one. I'll get it fixed soon.
Comment #28
bomarmonk commentedSubscribing, so I know when this is fixed... I am seeing errors too, although they don't seem to break anything. Thanks for the fix, when it comes.
Comment #29
karens commentedOK, hopefully this is now fixed in both cvs and 4.7. Let me know if it does not work.
Comment #30
karens commentedForgot to say thanks chaos21in for the debugging effort. It saved me a lot of time!
Comment #31
(not verified) commented