• Create user view
  • Add relationship "Flags : User's flagged content"
  • Add Field "(user flagged content) Flags : Flag link"
user warning: Unknown column 'users.nid' in 'field list' query: SELECT users.uid AS uid, users.name AS users_name, content_id, users.nid AS users_nid FROM users users INNER JOIN flag_content flag_content_users ON users.uid = flag_content_users.uid AND flag_content_users.fid = 3 LIMIT 0, 10 in /www/drupal/sites/all/modules/views/includes/view.inc on line 755.

It seems to me that the column should be users.uid not users.nid, but I don't know drupal enough to be sure. Anyway it looks like to be a bug since the module should not generate incorrect SQL requests.

Comments

quicksketch’s picture

I'm not sure if this is a fixable problem. This error only occurs if when setting up your relationship you select a node-flag. Since there is no node available to do the query when starting with a user-view, the SQL error results. If you set up a relationship and select a user-flag, everything works just fine.

So the logical thing might seem to be to remove the node-flags from the list of flags when adding the relationship. However adding a node-flag is still allowed as long as a node-relationship has been added first, so we can't just remove the option entirely. The only thing we could do I think is to give the user a validation error, saying that they configured the view incorrectly by using a node-flag within a user-view.

quicksketch’s picture

Title: SQL error in view module when selecting user flagged content » SQL error when using node-based flag Ops in a User view

I was trying to solve this problem but I can't get Views to not execute the query and prevent errors from displaying. For now, I think the solution is just "don't do that". Adding a node-based flag to a user-list just won't work for the mean time until I can figure out how to prevent the Ops field from being listed at all.

R.Hendel’s picture

Hello,
I have found this error in node views too.

Here is exported views code.
Hope that helps...

$view = new view;
$view->name = 'DEBUG_messe';
$view->description = 'DEBUG Messe';
$view->tag = 'Messe';
$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', 'Standards', 'default');
$handler->override_option('relationships', array(
  'field_ref_messestandort_nid' => array(
    'label' => 'Messe Standort',
    'required' => 1,
    'delta' => -1,
    'id' => 'field_ref_messestandort_nid',
    'table' => 'node_data_field_ref_messestandort',
    'field' => 'field_ref_messestandort_nid',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Übersteuern',
    ),
  ),
  'flag_user_content_rel' => array(
    'label' => 'Erinnerungsdienst',
    'required' => 0,
    'flag' => 'messeerinnerung',
    'id' => 'flag_user_content_rel',
    'table' => 'users',
    'field' => 'flag_user_content_rel',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'field_datum_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'short',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'both',
    ),
    'exclude' => 0,
    'id' => 'field_datum_value',
    'table' => 'node_data_field_datum',
    'field' => 'field_datum_value',
    'relationship' => 'none',
  ),
  'title_1' => array(
    'id' => 'title_1',
    'table' => 'node',
    'field' => 'title',
  ),
  'body' => array(
    'label' => 'Textkörper',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 0,
      'ellipsis' => 0,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'body',
    'table' => 'node_revisions',
    'field' => 'body',
    'relationship' => 'field_ref_messestandort_nid',
  ),
  'field_datum_value_1' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'format_interval',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'value',
    ),
    'exclude' => 0,
    'id' => 'field_datum_value_1',
    'table' => 'node_data_field_datum',
    'field' => 'field_datum_value',
    'relationship' => 'none',
  ),
  'field_teasermotiv_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_teasermotiv_fid',
    'table' => 'node_data_field_teasermotiv',
    'field' => 'field_teasermotiv_fid',
    'relationship' => 'none',
  ),
  'field_teasertext_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 0,
      'ellipsis' => 0,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_teasertext_value',
    'table' => 'node_data_field_teasertext',
    'field' => 'field_teasertext_value',
    'relationship' => 'none',
  ),
  'ops' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_type' => '',
    'exclude' => 0,
    'id' => 'ops',
    'table' => 'flag_content',
    'field' => 'ops',
    'relationship' => 'flag_user_content_rel',
  ),
));
$handler->override_option('sorts', array(
  'created' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'nid' => array(
    'default_action' => 'empty',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Alle',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '4' => 0,
      '5' => 0,
      '6' => 0,
      '8' => 0,
      '3' => 0,
      '7' => 0,
    ),
    'override' => array(
      'button' => 'Übersteuern',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'webform' => 0,
      'artikel' => 0,
      'ausstellerpremiumprofil' => 0,
      'ausstellerprofil' => 0,
      'bildwelt' => 0,
      'messe' => 0,
      'messeeindruckfoto' => 0,
      'messeeindruckvideo' => 0,
      'messesong' => 0,
      'messestand' => 0,
      'messestandort' => 0,
      'messevortrag' => 0,
      'news' => 0,
      'pressematerial' => 0,
      'pressespiegel' => 0,
      'referentenprofil' => 0,
      'seite' => 0,
      'specialvortrag' => 0,
      'vortrag' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '2' => 0,
      '3' => 0,
      '4' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_node_flag_name' => '*relationship*',
    'validate_argument_node_flag_test' => 'flaggable',
    'validate_argument_node_flag_id_type' => 'id',
    'validate_argument_user_flag_name' => '*relationship*',
    'validate_argument_user_flag_test' => 'flaggable',
    'validate_argument_user_flag_id_type' => 'id',
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'messe' => 'messe',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Übersteuern',
    ),
  ),
  'status_extra' => array(
    'operator' => '=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('empty', 'Messe nicht gefunden.');
$handler->override_option('empty_format', '3');
$handler->override_option('items_per_page', 0);
$handler->override_option('row_options', array(
  'inline' => array(),
  'separator' => '',
  'hide_empty' => 1,
));
$handler = $view->new_display('panel_pane', 'VP Messe', 'panel_pane_1');
$handler->override_option('pane_title', 'VP Messe');
$handler->override_option('pane_description', 'VP Messe');
$handler->override_option('pane_category', array(
  'name' => 'Panel-Ansichten',
  'weight' => 0,
));
$handler->override_option('allow', array(
  'use_pager' => FALSE,
  'items_per_page' => FALSE,
  'offset' => FALSE,
  'link_to_view' => FALSE,
  'more_link' => FALSE,
  'path_override' => FALSE,
  'title_override' => FALSE,
  'exposed_form' => FALSE,
  'fields_override' => FALSE,
));
$handler->override_option('argument_input', array(
  'nid' => array(
    'type' => 'panel',
    'context' => 'node.mod-????',
    'context_optional' => 0,
    'panel' => '0',
    'fixed' => '',
    'label' => 'Node: Beitrags-ID',
  ),
));
$handler->override_option('link_to_view', 0);
$handler->override_option('inherit_panels_path', 0);
R.Hendel’s picture

#3 was my own mistake: I chosed wrong relation type.

mooffie’s picture

Status: Active » Closed (duplicate)