SQL error on view matching text field whose allowed values includes a blank
reikiman - July 5, 2008 - 15:11
| Project: | Content Construction Kit (CCK) |
| Version: | 6.x-2.0-rc3 |
| Component: | Views Integration |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I have two views defined querying a group of nodes I've defined with CCK. One of the fields is a text field with a list of allowed values. Some of the allowed values have blanks in some names. In the error (listed below) one of these allowed values ("Carbon Neutral") is showing up in the SQL query as if it were a field name.
user 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 'Neutral ON node.vid = node_data_field_web_hosting_special_featu_Carbon Neutral.v' at line 5 query: SELECT COUNT(*) FROM (SELECT node.nid AS nid, node.title AS node_title FROM node node LEFT JOIN content_field_web_hosting_special_featu node_data_field_web_hosting_special_featu_Green ON node.vid = node_data_field_web_hosting_special_featu_Green.vid AND node_data_field_web_hosting_special_featu_Green.field_web_hosting_special_featu_value = 'Green' LEFT JOIN content_field_web_hosting_special_featu node_data_field_web_hosting_special_featu_Carbon Neutral ON node.vid = node_data_field_web_hosting_special_featu_Carbon Neutral.vid AND node_data_field_web_hosting_special_featu_Carbon Neutral.field_web_hosting_special_featu_value = 'Carbon Neutral' WHERE (node.type in ('web_hosting_provider')) AND (node.status <> 0) AND (node_data_field_web_hosting_special_featu_Green.field_web_hosting_special_featu_value = 'Green' OR node_data_field_web_hosting_special_featu_Carbon Neutral.field_web_hosting_special_featu_value = 'Carbon Neutral') ) AS count_alias in /home/.nurse/reikiman/davidherron.com/sites/all/modules/views/includes/view.inc on line 652.user 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 'Neutral ON node.vid = node_data_field_web_hosting_special_featu_Carbon Neutral.v' at line 5 query: SELECT node.nid AS nid, node.title AS node_title FROM node node LEFT JOIN content_field_web_hosting_special_featu node_data_field_web_hosting_special_featu_Green ON node.vid = node_data_field_web_hosting_special_featu_Green.vid AND node_data_field_web_hosting_special_featu_Green.field_web_hosting_special_featu_value = 'Green' LEFT JOIN content_field_web_hosting_special_featu node_data_field_web_hosting_special_featu_Carbon Neutral ON node.vid = node_data_field_web_hosting_special_featu_Carbon Neutral.vid AND node_data_field_web_hosting_special_featu_Carbon Neutral.field_web_hosting_special_featu_value = 'Carbon Neutral' WHERE (node.type in ('web_hosting_provider')) AND (node.status <> 0) AND (node_data_field_web_hosting_special_featu_Green.field_web_hosting_special_featu_value = 'Green' OR node_data_field_web_hosting_special_featu_Carbon Neutral.field_web_hosting_special_featu_value = 'Carbon Neutral') LIMIT 0, 30 in /home/.nurse/reikiman/davidherron.com/sites/all/modules/views/includes/view.inc on line 677.
#1
I can't reproduce this.
Could you paste an export of the view you're using ?
Besides, it seems that your field name is quite long and has been truncated at some point ('field_web_hosting_special_featu' is 31 chars long, the db limit being 32). Maybe related, maybe not.
This limitation, while present in the db, has been enforced in the UI only recently ('create field' form doesn't validate if the field name is too long).
Maybe your field was created before this change in the D6 code ? Or does it come from a D5 site upgraded to D6 ?
#2
Very old report, no response, assuming fixed.
#3
Automatically closed -- issue fixed for two weeks with no activity.