When a non-admin user visits any /project/issues/projectname URL they get an error, and in the log, this:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_project_type0.nid' in 'where clause': SELECT field_data_field_project_type0.entity_type AS entity_type, field_data_field_project_type0.entity_id AS entity_id, field_data_field_project_type0.revision_id AS revision_id, field_data_field_project_type0.bundle AS bundle FROM {field_data_field_project_type} field_data_field_project_type0 INNER JOIN {field_data_field_project_has_issue_queue} field_data_field_project_has_issue_queue1 ON field_data_field_project_has_issue_queue1.entity_type = field_data_field_project_type0.entity_type AND field_data_field_project_has_issue_queue1.entity_id = field_data_field_project_type0.entity_id INNER JOIN {field_data_field_project_machine_name} field_data_field_project_machine_name2 ON field_data_field_project_machine_name2.entity_type = field_data_field_project_type0.entity_type AND field_data_field_project_machine_name2.entity_id = field_data_field_project_type0.entity_id WHERE (field_data_field_project_type0.field_project_type_value IS NOT NULL ) AND (field_data_field_project_has_issue_queue1.field_project_has_issue_queue_value = :db_condition_placeholder_0) AND (field_data_field_project_machine_name2.field_project_machine_name_value = :db_condition_placeholder_1) AND (field_data_field_project_type0.deleted = :db_condition_placeholder_2) AND (field_data_field_project_type0.entity_type = :db_condition_placeholder_3) AND(( ( EXISTS (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) ))AND (na.grant_view >= :db_condition_placeholder_8) AND (field_data_field_project_type0.entity_id = na.nid) )) AND (field_data_field_project_type0.entity_type = :db_condition_placeholder_9) )OR (field_data_field_project_type0.entity_type <> :db_condition_placeholder_10) )AND ( EXISTS (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid = :db_condition_placeholder_11) AND (na.realm = :db_condition_placeholder_12) )OR( (na.gid = :db_condition_placeholder_13) AND (na.realm = :db_condition_placeholder_14) ))AND (na.grant_view >= :db_condition_placeholder_15) AND (field_data_field_project_type0.nid = na.nid) )) ; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => virtual_server [:db_condition_placeholder_2] => 0 [:db_condition_placeholder_3] => node [:db_condition_placeholder_4] => 0 [:db_condition_placeholder_5] => all [:db_condition_placeholder_6] => 62 [:db_condition_placeholder_7] => private_author [:db_condition_placeholder_8] => 1 [:db_condition_placeholder_9] => node [:db_condition_placeholder_10] => node [:db_condition_placeholder_11] => 0 [:db_condition_placeholder_12] => all [:db_condition_placeholder_13] => 62 [:db_condition_placeholder_14] => private_author [:db_condition_placeholder_15] => 1 ) in field_sql_storage_field_storage_query() (line 652 of /home/buggy/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

I've tried creating new project nodes, to see if this is maybe related to our migration from Drupal 6 (I was guessing maybe some fields didn't get populated, but that's not it).

The error seems to be happening in Advanced->Contextual filters->(Project) Content: nid->Validation setting. Using any other validation prevents the error, but there are no results (of course).

Looking at the code (which inherits from the project nid validator), it looks like it ought to be able to accept either the machine_name or the nid, so I tried making a version of the view that used the machine_name instead of nid, and that caused the same error (including mention of the nid, even though I'm using machine_name in that one).

The really confusing thing is that this problem doesn't happen for admin users; the view works correctly.I don't see any permissions that would be obviously related to this (though I did grant authenticated users more privileges than I think is sane in order to try to make it work just to rule out permissions). But, maybe I'm missing a permission here?

The only other thing I can think of may be that I'm using the "private" module, which allows nodes to be marked "private", allowing only admins and the user who created the item to see them. But, the project nodes are not marked private. Some issues, are, but I can't think of how that would trigger this error.

Obviously, this problem doesn't happen on d.o, so I guess it's something specific to my deployment, but I'm out of ideas for what else to try after poking at it off and on ever since we migrated months ago.

Note, that regular (non-admin) users can visit the project page (e.g. /project/projectname) without error. The problem is specifically within the project_issue contextual filter, I think.

Comments

swelljoe created an issue. See original summary.

swelljoe’s picture

Status: Active » Fixed

I resolved this by simply editing the database directly, adding an nid field to field_data_field_project_type and populating it with the same ID as found in the entity_id field (which seems to make the error go away and correct behavior to be available to non-1 users).

I assume this problem occurred because my Drupal installation was upgraded from D6 to D6, and no upgrade path is provided for the project_issue module, so I had to wing it...I guess I got it wrong.

Status: Fixed » Closed (fixed)

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