Steps to reproduce:

- Create a content type named "person".

- Give the person content type a cck text field of "lastname". Create a node or three.

- Use the following view, which defines a page display and an attached glossary-summary display:

$view = new view;
$view->name = 'directorytest';
$view->description = 'A directory of people';
$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' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'field_lastname_value' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 1,
    'limit' => '1',
    'case' => 'upper',
    'path_case' => 'none',
    'transform_dash' => 0,
    'id' => 'field_lastname_value',
    'table' => 'node_data_field_lastname',
    'field' => 'field_lastname_value',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => 'C',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'academicevent' => 0,
      'block_institutional' => 0,
      'class_note' => 0,
      'course' => 0,
      'event' => 0,
      'exhibition' => 0,
      'news' => 0,
      'page' => 0,
      'page_inspirational' => 0,
      'page_institutional' => 0,
      'person' => 0,
      'portfolio' => 0,
      'portfolioimage' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '5' => 0,
      '3' => 0,
      '4' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$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',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('title', 'Directory');
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => 'name',
  'type' => 'ul',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'directory');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler = $view->new_display('attachment', 'Alpha pager', 'attachment_1');
$handler->override_option('arguments', array(
  'field_lastname_value' => array(
    'default_action' => 'summary asc',
    'style_plugin' => 'unformatted_summary',
    'style_options' => array(
      'count' => 0,
      'override' => 0,
      'items_per_page' => '25',
      'inline' => 0,
      'separator' => '',
    ),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'ignore',
    'glossary' => 1,
    'limit' => '1',
    'case' => 'upper',
    'path_case' => 'none',
    'transform_dash' => 0,
    'id' => 'field_lastname_value',
    'table' => 'node_data_field_lastname',
    'field' => 'field_lastname_value',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => 'A',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'academicevent' => 0,
      'block_institutional' => 0,
      'class_note' => 0,
      'course' => 0,
      'event' => 0,
      'exhibition' => 0,
      'news' => 0,
      'page' => 0,
      'page_inspirational' => 0,
      'page_institutional' => 0,
      'person' => 0,
      'portfolio' => 0,
      'portfolioimage' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '5' => 0,
      '3' => 0,
      '4' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'override' => array(
      'button' => 'Use default',
    ),
  ),
));
$handler->override_option('items_per_page', 0);
$handler->override_option('attachment_position', 'before');
$handler->override_option('inherit_arguments', 0);
$handler->override_option('inherit_exposed_filters', FALSE);
$handler->override_option('displays', array(
  'page_1' => 'page_1',
  'default' => 0,
));

On my site, with that view (I hope it imports properly), the page view works fine. However, even though there are 4 person nodes, the summary view (which is pulling from the lastname field) shows one record only: "". The resulting SQL for the attached display is:

SELECT SUBSTR(node_data_field_lastname.field_lastname_value, 1, 1) AS field_lastname_value_truncated,
   COUNT(node.nid) AS num_records
 FROM node node 
 LEFT JOIN content_type_person node_data_field_lastname ON node.vid = node_data_field_lastname.vid
 WHERE node.type in ('person')
 GROUP BY field_lastname_value_truncated
  ORDER BY field_lastname_value_truncated ASC

When I put that into Navicat directly, sure enough I get one record back with no value for field_lastname_value_truncated and an appropriate count(). If, however, I remove the count(), GROUP BY, and ORDER BY (yes, the ORDER BY matters), then I get back a single column of proper substrings. The most confusing is the ORDER BY, as with that there I get no records but without it I get the correct number of records.

I am at this point quite confused. Any suggestions?

Comments

merlinofchaos’s picture

I tried it out and it works for me. I suspect MySQL bug, given the inconsistency in the result you see.

Crell’s picture

Exciting. I'll have to see if I can get a hold of another system for testing and see if it works there or if I'm just not providing adequate reproduction instructions.

Crell’s picture

Status: Active » Fixed

On further investigation, it was indeed a bug in our version of MySQL. Specifically, MySQL 5.0.32 has a bug that was breaking that query and making it return nothing. Another server running MySQL 5.0.44 worked, and upgrading ours to 5.0.51a worked as well.

So not a Views problem. Leaving this note here for the search engines.

Status: Fixed » Closed (fixed)

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