Getting the following error trying to display a view using a custom CCK nodereference field and a relationship:
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 ') ORDER BY nid ASC, delta ASC' at line 1 query: SELECT vid AS _vid, delta as _delta, nid AS _nid, field_blog_parent_nid AS nid FROM content_field_blog_parent WHERE vid IN () ORDER BY nid ASC, delta ASC in .../htdocs/sites/all/modules/contrib/cck/includes/views/handlers/content_handler_field_multiple.inc on line 161.
Here's the view:
$view = new view;
$view->name = 'Blog';
$view->description = 'Views for displaying blog posts and blogrolls';
$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('relationships', array(
'field_blog_parent_nid' => array(
'label' => 'Blog Parent',
'required' => 0,
'delta' => '-1',
'id' => 'field_blog_parent_nid',
'table' => 'node_data_field_blog_parent',
'field' => 'field_blog_parent_nid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_blog_parent_nid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => 1,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_blog_parent_nid',
'table' => 'node_data_field_blog_parent',
'field' => 'field_blog_parent_nid',
'relationship' => 'field_blog_parent_nid',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'blog' => 'blog',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'blogs');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comments
Comment #1
markus_petrux commentedPlease, upgrade CCK. This issue was fixed in CCK 6.x-2.5
- #522112: Ugly mysql warning when empty $vids for prerender in content_handler_field_multiple
Comment #2
wonder95 commentedYup, I upgraded to 6.x-2.6 and noticed the code to handle that.
Thanks.