Clean install of D7-RC4,
Calendar 7.x-1.x-dev (2010-Dec-30)
Date 7.x-1.x-dev (2010-Dec-29)
Chaos tool suite 7.x-1.x-dev (2010-Nov-10) or alpha1 (tried both)
Views 7.x-3.x-dev (2010-Dec-31) (also with 2010-Dec-30)
Open provided Calendar view
Change argument from Node: updated date to a date field that has been added to a content type. Mine is called field_when.
Save the View and look at the calendar:
'Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'field_data_field_when.field_when_value\' in \'where clause\''
in views_plugin_query_default->execute() (line 1193 of /sites/all/modules/views/plugins/views_plugin_query_default.inc).
Back on the Calendar View configuration in the preview there is the following SQL:
SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.type AS node_type
FROM
{node} node
WHERE (( (node.status = '1') AND (node.type IN ('meeting', 'test')) )AND( ((DATE_FORMAT(CONVERT_TZ(field_data_field_when.field_when_value, 'UTC', 'America/Los_Angeles'), '%Y-%m') <= '2010-12' AND DATE_FORMAT(CONVERT_TZ(field_data_field_when.field_when_value, 'UTC', 'America/Los_Angeles'), '%Y-%m') >= '2010-12')) ))It looks to me as though the query is being created as though the date field didn't have its own table. field_data_field_when.field_when_value is correct, but shouldn't field_data_field_when be in the FROM clause of the query?
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | date-1011624-34.patch | 1.22 KB | tim.plunkett |
Comments
Comment #1
gscerb commentedsubscribe
Comment #2
pipeline commentedSame problem for me...
Comment #3
Stevel commentedMarked #1018604: Error on new install - Debug: 'Exception: SQLSTATE[42S22]: Column not found: as a duplicate
Comment #4
sven.lauer commentedsubscribe
Comment #5
clauded commentedsubscribe
Comment #6
Kreativs commentedsubscribe
Comment #7
ryan osītis commentedsubscribe
Comment #8
monjohn commentedsubscribe
Comment #9
robboten commentedsubscribe
Comment #10
NoDice commentedsubscribe
Comment #11
rublev_green commentedsubscribe
Comment #12
waverate commentedsubscribe
Comment #13
jonasdowney commentedsubscribe
Comment #14
Kiwigirl commentedsubscribe
Comment #15
mbarnson commentedSubscribed. I'm encountering the same issue at a brand-new Drupal 7 demo site, http://utahheli.org/ . Very frustrating to go from "it just works" to blowing up when I add the block.
Full error (changed path to home directory):
Debug:
'Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'field_data_field_date.field_date_value\' in \'where clause\''
in views_plugin_query_default->execute() (line 1314 of /my/path/utahheli.org/sites/all/modules/views/plugins/views_plugin_query_default.inc).
Debug:
'Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'field_data_field_date.field_date_value\' in \'where clause\''
in views_plugin_query_default->execute() (line 1314 of /my/path/utahheli.org/sites/all/modules/views/plugins/views_plugin_query_default.inc).
Steps followed:
* Updated to -dev via CVS on otherwise bone-stock Drupal 7.0.
* re-ran update.php; no changes found.
* re-saved modules
* cleared drupal cache
* cleared browser cache
* re-edited date fields & saved. Didn't change anything as the values look reasonable. Same with display fields.
* Double-checked views, not using it anywhere except the out-of-box Date Tools option.
* Found this similar bug report and added my two cents to it :)
Thanks for figuring this out! I actually reinstalled everything from scratch and made sure Date & Calendar were the first modules I installed (along with their dependencies). Identical behavior, but useful to know it wasn't something else necessarily causing the problem.
Comment #16
lynnmart881 commentedsubscribe
Comment #17
drnikki commentedsame as mbarnson, subscribing.
Comment #18
mbarnson commentedYep. You don't actually have to do anything special to cause this bug to appear. Just try to enable the calendar view in the sidebar after installing Date and Calendar and adding any node with a DateTime field. It's a complete show-stopper using the release or -dev versions of Date & Calendar on Drupal 7.0.
Comment #19
mbarnson commentedPriority modification, as this pretty much prevents the use of Calendar completely. If you try to go to the Page view via http://some.url/calendar-date you also get the same errors.
Possibly related: If one attempts to Edit the View, this error is shown on the edit screen:
Notice: Undefined index: Date in views_handler_filter_in_operator->admin_summary() (line 318 of /some/path/sites/all/modules/views/handlers/views_handler_filter_in_operator.inc)
Note FullCalendar doesn't exhibit this same behavior; as a temporary workaround for those with Drupal 7, the FullCalendar module can be used to access a date calendar.
Comment #20
ionz149 commentedsubby
Comment #21
pivica commentedThis has nothing to do with Calendar module but with Date module. When trying to create simple view that list nodes that have date field and adding date view argument will produce same error when view is executed.
It seems that when adding date argument to a view appropriate join to field date table will not be added to sql query and that is the reason why views with Date arguments will not work - and calendar is also a view with date argument.
Comment #22
flunardelli commentedSubscribe
Comment #23
lukspa commentedAs for temporary solution you can add sorting on your date field, it should provide missing JOIN statement.
Comment #24
harper1983 commentedsubscribe
Comment #25
Orjan commentedsubscribe
Comment #26
karens commentedI think I have this fixed now.
Comment #27
gorillaz.f commentedhi karenS,
I've post an issue in calendar project http://drupal.org/node/1033464
It seems to be similar with this topic here.
Although I get no debug message saying "column not found", but it related to date field argument that make calendar view fail to show events.
Would you please take a look at it ?
Comment #29
arlinsandbulte commented#1094408: Date field not showing up in views arguments in localized site might have affected or fixed this issue.
Please verify this issue exists with the March 28 -dev
Comment #30
zabelc commented@arlinsandbulte I'm seeing this in 7.x-2.x-dev from 2011-03-28
Comment #31
Eaglecanada commentedproblem still exist with "week" view on the full calendar page ( Year, Month and Day are fine):
Notice: Undefined variable: field in date_views_argument_handler_simple->query() (line 210 ..
'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 \' SEC_TO_TIME(-14400)) <= \'2011-12-05 00:00:00\' AND ADDTIME(, SEC_TO_TIME(-14400)\' at line 2'
in views_plugin_query_default->execute() (line 1314 of \sites\all\modules\views\plugins\views_plugin_query_default.inc).
Sorry, I amusing: 7.x-2.0-alpha1
Comment #32
karens commentedDon't use alpha1 when testing if bugs are fixed, they are fixed in the dev version and the fixes will roll into the next release. I also have made a number of fixes in the last couple days. I can't replicate any problems in the latest code.
Comment #33
jsheffers commentedI am still getting this as well.
With latest dev versions of Ctools, Views, Date, and Calendar. I have also followed this guide http://drupal.org/node/755312.
Here is my setup.
I have 2 content types - one relates to the other.
Parents and Children, I have a node reference field that references the children to their parents. So in the view I'm bringing in the fields of the children content type. Normally I would add a relationship which is the node reference field, and contextual filter for the NID that uses the relationship. This setup works on the current stable versions of these modules, but not on the dev versions. Unfortunately in order to get the calendar to work I have to use all of the dev modules, so now I'm stuck. Any ideas on how to fix this.
As soon as I remove the relationship, which is a node reference field, the error goes away. That being said the relationship and contextual filter never function correctly (Children never show on Parents page). I'm using EVA to attach the view to the parents content type FYI.
Comment #34
tim.plunkettReopening this, let me know if this should be spun off into a different issue.
When adding a date field argument that is from an entity_type that differs from the $view->base_table, there is no part of the query that adjusts for this.
I borrowed this code from views_handler_field_entity::query.
Comment #35
tim.plunkettDidn't notice the priority when I reopened it. In the core sense, I'd call this major as it doesn't whitescreen or anything.
This makes modules like entityreference and field_collection spit out errors and they are unusable for date fields without this, so tagging as a blocker.
Comment #36
tim.plunkettIn IRC you mentioned that I should double-check date_views_argument_handler.inc when adding to date_views_argument_handler_simple.inc and vice versa, but in this case date_views_argument_handler::query() calls parent::query() anyway, so there's no need.
Comment #37
karens commentedI took a different approach to fix this. There were several places where the wrong base table was being used to retrieve fields in both the filters and the arguments. But I found that when the handler is initiated we have access to the right base table for the field. So I am storing that base_table value in init() and then using that whenever we pull a list of available fields. There is also a fix to always keep the Date filter itself out of the results. It was already fixed for Node views but needed to be adjusted to work for all base tables.
Tested with user relationships to a node view but should work fine for any other tables.
http://drupalcode.org/project/date.git/commit/514969e
Comment #38
karens commentedAdjusting the title to reflect the current problem being fixed. We probably should have made this a separate issue, but too late now.