Hello,

Here is the situation :

I have a content type : Thème de recherche (research topic) and I want my users to be able to choose their research topic when they register. For this, I use a Entity reference field that I added to the user registration form.

The problem :
- When I add a user when logged in as Admin, everything works smoothly.
- When an anonymous user attempts to register, it triggers a PDOException like so :

PDOException : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_body0.status' in 'where clause': SELECT DISTINCT field_data_body0.entity_type AS entity_type, field_data_body0.entity_id AS entity_id, field_data_body0.revision_id AS revision_id, field_data_body0.bundle AS bundle FROM {field_data_body} field_data_body0 WHERE (field_data_body0.deleted = :db_condition_placeholder_0) AND (field_data_body0.entity_type = :db_condition_placeholder_1) AND (field_data_body0.bundle IN (:db_condition_placeholder_2)) AND (field_data_body0.status = :db_condition_placeholder_3) ORDER BY field_data_body0.body_value ASC; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => node [:db_condition_placeholder_2] => theme_de_recherche [:db_condition_placeholder_3] => 1 ) dans field_sql_storage_field_storage_query() (ligne 577 dans /var/www/dev/cfv/releases/drupal/modules/field/modules/field_sql_storage/field_sql_storage.module).

If I remove the Entity reference field from the user registration form, everything works again. I've not been able to quite locate the problem though... I've looked at my database schema and the 'field_data_body0.status' does not exist.

Any clue how to fix this?

Thank you for your help.

Comments

tisbris’s picture

I also got this error when I select - sort by 'A field attached to this entity'.

If I sort by 'A property of the base table of the entity' everything is okay.

damien tournoud’s picture

Title: Column not found 1054 exception is triggered when trying to load the user_register_form() as an Anonymous user » EntityReference_SelectionHandler_Generic_node::entityFieldQueryAlter() expects the base table to be there

Hm. I can understand why it errors out. EntityReference_SelectionHandler_Generic_node::entityFieldQueryAlter() expects the base table to be in the query generated by EFQ, but if you have a field-only query, it will not.

damien tournoud’s picture

Status: Active » Closed (duplicate)