If mysql is set to distinguish letter cases in field names, db_distinct_field breaks queries.

ie. using Date + Calendar modules:

user warning: Unknown column 'node_data_field_dateFROM.field_datefrom_value' in 'field list' query: SELECT node.nid AS nid, node.title AS node_title, node_data_field_dateFROM.field_datefrom_value AS node_data_field_datefrom_field_datefrom_value, node_data_field_datefrom.field_datefrom_value2 AS node_data_field_datefrom_field_datefrom_value2, node.type AS node_type, node.vid AS node_vid FROM node node LEFT JOIN content_type_event2 node_data_field_datefrom ON node.vid = node_data_field_datefrom.vid WHERE (DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_datefrom.field_datefrom_value, '%Y-%m-%dT%T'), SEC_TO_TIME(3600)), '%Y-%m') <= '2010-02' AND DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_datefrom.field_datefrom_value2, '%Y-%m-%dT%T'), SEC_TO_TIME(3600)), '%Y-%m') >= '2010-02') in //sites/all/modules/views/includes/view.inc on line 769.

I 've added word bounds around FROM in bugged regular expression. This bug is present in all sql backends, my patch covers only mysql.

CommentFileSizeAuthor
db_distinct_field.diff541 bytesComitto
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.