I was creating a view and decided to remove ajax. After doing so I've started getting this error which stays regardless of whether ajax is enabled or not.

The position field, where the error seems to be occuring, is a text field which the user selects and it is exposed within the view.

After clicking around for awhile I found a setting that wouldn't throw the error. If I set it so operator is "is one of", optional is checked, force single is not checked, remember is checked. If I change the operator to "is all of", the error returns and if I check "force single" the error returns.

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 ') AND (node_data_field_responded.field_responded_value = 'example position') ' at line 18 query: SELECT node.nid AS nid, node.title AS node_title, node.type AS node_type, node_data_field_position.field_position_value AS node_data_field_position_field_position_value, node_data_field_position.nid AS node_data_field_position_nid, node_data_field_position.field_email_email AS node_data_field_position_field_email_email, node_data_field_position.field_phone_value AS node_data_field_position_field_phone_value, node_data_field_responded.field_responded_value AS node_data_field_responded_field_responded_value, node_data_field_responded.nid AS node_data_field_responded_nid, node_data_field_position.field_initial_email_sent_value AS node_data_field_position_field_initial_email_sent_value, node_data_field_position.field_current_status_ in /home/frauditn/public_html/statewide/sites/all/modules/views/includes/view.inc on line 689.

The full query is this:

SELECT node.nid AS nid,
   node.title AS node_title,
   node.type AS node_type,
   node_data_field_position.field_position_value AS node_data_field_position_field_position_value,
   node_data_field_position.nid AS node_data_field_position_nid,
   node_data_field_position.field_email_email AS node_data_field_position_field_email_email,
   node_data_field_position.field_phone_value AS node_data_field_position_field_phone_value,
   node_data_field_position.field_responded_value AS node_data_field_position_field_responded_value,
   node_data_field_position.field_initial_email_sent_value AS node_data_field_position_field_initial_email_sent_value,
   node_data_field_current_status.field_current_status_value AS node_data_field_current_status_field_current_status_value,
   node_data_field_current_status.nid AS node_data_field_current_status_nid,
   node_data_field_position.field_geo_division_value AS node_data_field_position_field_geo_division_value,
   node_data_field_position.field_unit_value AS node_data_field_position_field_unit_value,
   node_data_field_position.field_unit_type_value AS node_data_field_position_field_unit_type_value
 FROM node node 
 INNER JOIN content_type_person node_data_field_current_status ON node.vid = node_data_field_current_status.vid
 LEFT JOIN content_type_person node_data_field_position ON node.vid = node_data_field_position.vid
 WHERE (node.type in ('person')) AND () AND (node_data_field_current_status.field_current_status_value = 'example position') AND (node_data_field_current_status.field_unit_type_value = 'example status')
   ORDER BY node_data_field_current_status_field_current_status_value ASC

Comments

kyle_mathews’s picture

Oh, and here's the exported view:

$view = new view;
$view->name = 'all_people';
$view->description = 'Shows all people with exposed controls';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => 'Name',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_position_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_position_value',
    'table' => 'node_data_field_position',
    'field' => 'field_position_value',
    'relationship' => 'none',
  ),
  'field_email_email' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_email_email',
    'table' => 'node_data_field_email',
    'field' => 'field_email_email',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_phone_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_phone_value',
    'table' => 'node_data_field_phone',
    'field' => 'field_phone_value',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_responded_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_responded_value',
    'table' => 'node_data_field_responded',
    'field' => 'field_responded_value',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_initial_email_sent_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_initial_email_sent_value',
    'table' => 'node_data_field_initial_email_sent',
    'field' => 'field_initial_email_sent_value',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_current_status_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_current_status_value',
    'table' => 'node_data_field_current_status',
    'field' => 'field_current_status_value',
    'relationship' => 'none',
  ),
  'field_geo_division_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_geo_division_value',
    'table' => 'node_data_field_geo_division',
    'field' => 'field_geo_division_value',
    'relationship' => 'none',
  ),
  'field_unit_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_unit_value',
    'table' => 'node_data_field_unit',
    'field' => 'field_unit_value',
    'relationship' => 'none',
  ),
  'field_unit_type_value' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_unit_type_value',
    'table' => 'node_data_field_unit_type',
    'field' => 'field_unit_type_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'field_current_status_value' => array(
    'order' => 'ASC',
    'id' => 'field_current_status_value',
    'table' => 'node_data_field_current_status',
    'field' => 'field_current_status_value',
    'relationship' => 'none',
  ),
  'field_geo_division_value' => array(
    'order' => 'ASC',
    'id' => 'field_geo_division_value',
    'table' => 'node_data_field_geo_division',
    'field' => 'field_geo_division_value',
    'relationship' => 'none',
  ),
  'field_responded_value' => array(
    'order' => 'ASC',
    'id' => 'field_responded_value',
    'table' => 'node_data_field_responded',
    'field' => 'field_responded_value',
    'relationship' => 'none',
  ),
  'field_initial_email_sent_value' => array(
    'order' => 'ASC',
    'id' => 'field_initial_email_sent_value',
    'table' => 'node_data_field_initial_email_sent',
    'field' => 'field_initial_email_sent_value',
    'relationship' => 'none',
  ),
  'field_unit_value' => array(
    'order' => 'ASC',
    'id' => 'field_unit_value',
    'table' => 'node_data_field_unit',
    'field' => 'field_unit_value',
    'relationship' => 'none',
  ),
  'field_unit_type_value' => array(
    'order' => 'ASC',
    'id' => 'field_unit_type_value',
    'table' => 'node_data_field_unit_type',
    'field' => 'field_unit_type_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'person' => 'person',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_position_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_position_value_op',
      'identifier' => 'field_position_value',
      'label' => 'Position',
      'optional' => 1,
      'single' => 0,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_position_value',
    'table' => 'node_data_field_position',
    'field' => 'field_position_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_current_status_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_current_status_value_op',
      'identifier' => 'field_current_status_value',
      'label' => 'Current Status',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_current_status_value',
    'table' => 'node_data_field_current_status',
    'field' => 'field_current_status_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_unit_value' => array(
    'operator' => 'and',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_unit_value_op',
      'identifier' => 'field_unit_value',
      'label' => 'Unit Name',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_unit_value',
    'table' => 'node_data_field_unit',
    'field' => 'field_unit_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_unit_type_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_unit_type_value_op',
      'identifier' => 'field_unit_type_value',
      'label' => 'Unit Type',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_unit_type_value',
    'table' => 'node_data_field_unit_type',
    'field' => 'field_unit_type_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_geo_division_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_geo_division_value_op',
      'identifier' => 'field_geo_division_value',
      'label' => 'Georgraphical Division',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_geo_division_value',
    'table' => 'node_data_field_geo_division',
    'field' => 'field_geo_division_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_responded_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_responded_value_op',
      'identifier' => 'field_responded_value',
      'label' => 'Has the person responded?',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_responded_value',
    'table' => 'node_data_field_responded',
    'field' => 'field_responded_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'field_initial_email_sent_value' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_initial_email_sent_value_op',
      'identifier' => 'field_initial_email_sent_value',
      'label' => 'Initial email sent',
      'optional' => 1,
      'single' => 1,
      'remember' => 1,
      'reduce' => 0,
    ),
    'id' => 'field_initial_email_sent_value',
    'table' => 'node_data_field_initial_email_sent',
    'field' => 'field_initial_email_sent_value',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'role',
  'role' => array(
    '4' => 4,
    '1' => 1,
    '3' => 3,
  ),
));
$handler->override_option('title', 'Prop 8 Workers');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => 'field_current_status_value',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'title' => 'title',
    'field_email_email' => 'field_email_email',
    'field_phone_value' => 'field_phone_value',
    'field_responded_value' => 'field_responded_value',
    'field_initial_email_sent_value' => 'field_initial_email_sent_value',
    'name' => 'name',
    'field_current_status_value' => 'field_current_status_value',
    'field_geo_division_value' => 'field_geo_division_value',
    'field_unit_value' => 'field_unit_value',
    'field_unit_type_value' => 'field_unit_type_value',
  ),
  'info' => array(
    'title' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_email_email' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_phone_value' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_responded_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'field_initial_email_sent_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'name' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_current_status_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'field_geo_division_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'field_unit_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
    'field_unit_type_value' => array(
      'sortable' => 1,
      'separator' => '',
    ),
  ),
  'default' => 'field_current_status_value',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'table');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
merlinofchaos’s picture

Project: Views (for Drupal 7) » Content Construction Kit (CCK)
Version: 6.x-2.0-rc3 » 6.x-2.x-dev
Component: Code » Views Integration

CCK needs a 'var $no_single = TRUE' on the handler for text fields to prevent that setting from appearing.

karens’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot replicate this problem using the latest code. I've tried every possible combination of text selection filters and cannot generate any errors. This code is using the many_to_one filter. I could add $no_single to it, but I hate to do that without being able to generate any errors myself. We use that filter for both any text and numeric fields that have 'allowed values' lists.

If this is really needed in the latest code I need a simple example that I can replicate that will generate an error if it's set up wrong. The attached view is super complicated and has lots of other fields and filters so I have no idea how to replicate this problem.

merlinofchaos’s picture

KarenS: I was guessing. If you can't replicate the problem then my guess may be incorrect. =)

karens’s picture

Then I won't do anything and will wait for confirmation that there is still a problem in the latest code, hopefully with a simple example of a specific field and its settings that is used as a filter.

I'm just getting ready to push out a new rc9, so wait for that and then check.

yched’s picture

Status: Postponed (maintainer needs more info) » Fixed

So far we intentionally left the code unshielded, precisely because it detects that some code somewhere (either in core or in 3rd party contrib) is doing something wrong. However, while CCK is not the source of the bug, those issues end up polluting the our issue queue, generating threads that quickly become flooded with unrelated 'me too's because such problems can come from many different sources. Enough with this.
I added code in the few places I could spot that could get broken to babysit invalid incoming data.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.