After adding a date argument to a view, I got error messages:

user warning: Unknown table 'node_data_field_news_date' in where clause query: SELECT COUNT(*) FROM (SELECT node.title AS node_title, node_data_field_news_author.field_news_author_value AS node_data_field_news_author_field_news_author_value, node_data_field_news_author.delta AS node_data_field_news_author_delta, node.type AS node_type, node.nid AS nid, node.vid AS node_vid, node_data_field_news_source.field_news_source_value AS node_data_field_news_source_field_news_source_value, node_data_field_news_source.field_news_date_value AS node_data_field_news_source_field_news_date_value, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format, node_data_field_news_source.field_news_url_value AS node_data_field_news_source_field_news_url_value FROM node node LEFT JOIN content_field_news_author node_data_field_news_author ON node.vid = node_data_field_news_author.vid LEFT JOIN content_type_news node_data_field_news_source ON node.vid = node_data_field_news_source.vid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE (node.type in ('news')) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_news_date.field_news_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-11' AND DATE_FORMAT(STR_TO_DATE(node_data_field_news_date.field_news_date_value, '%Y-%m-%dT%T'), '%Y-%m') >= '2010-11')) ) count_alias in /home/bmsg/public_html/tempo/sites/all/modules/views/plugins/views_plugin_pager.inc on line 141.
user warning: Unknown table 'node_data_field_news_date' in where clause query: SELECT node.title AS node_title, node_data_field_news_author.field_news_author_value AS node_data_field_news_author_field_news_author_value, node_data_field_news_author.delta AS node_data_field_news_author_delta, node.type AS node_type, node.nid AS nid, node.vid AS node_vid, node_data_field_news_source.field_news_source_value AS node_data_field_news_source_field_news_source_value, node_data_field_news_source.field_news_date_value AS node_data_field_news_source_field_news_date_value, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format, node_data_field_news_source.field_news_url_value AS node_data_field_news_source_field_news_url_value FROM node node LEFT JOIN content_field_news_author node_data_field_news_author ON node.vid = node_data_field_news_author.vid LEFT JOIN content_type_news node_data_field_news_source ON node.vid = node_data_field_news_source.vid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE (node.type in ('news')) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_news_date.field_news_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-11' AND DATE_FORMAT(STR_TO_DATE(node_data_field_news_date.field_news_date_value, '%Y-%m-%dT%T'), '%Y-%m') >= '2010-11')) LIMIT 0, 10 in /home/bmsg/public_html/tempo/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1146.

It appears that a date argument won't work without a filter on the same date field - which I discovered after reading http://drupal.org/node/1016506 .

After reading that, I added a filter on the date field, setting it to select all items with a date greater than 1975 (figuring that would include all the nodes I've entered).

At that point, I readded my date field argument. It didn't work (didn't limit results to just the nodes that fall within the 2010-12 argument range), but I didn't get the error message, which was progress.

I then modified the argument to use Method: AND instead of OR - and it now works fine, limiting results to the argument date I enter, with no error messages.

I don't think arguments have typically required a corresponding filter in the past, so I think this is a bug.

As always, thanks for all the amazing work you do on this essential module!

Comments

dawehner’s picture

Project: Views (for Drupal 7) » Date
Version: 6.x-3.x-dev » 6.x-2.x-dev

This seems to be an issue of the date module. Sorry.

redndahead’s picture

Yes and I can confirm that adding a date filter and setting both it and the argument to using "AND" adds the correct join. Otherwise the view is broken. I have not tested the latest dev release though.

damienmckenna’s picture

Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.