When adding a role reference field to a relationship in a view I get this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_customer_groups.rid' in 'on clause'
This is the query:
SELECT node.created AS node_created, node.nid AS nid
FROM
{node} node
LEFT JOIN {field_data_field_customer_groups} field_data_field_customer_groups ON node.nid = field_data_field_customer_groups.entity_id AND (field_data_field_customer_groups.entity_type = 'node' AND field_data_field_customer_groups.deleted = '0')
LEFT JOIN {role} role_field_data_field_customer_groups ON field_data_field_customer_groups.rid = role_field_data_field_customer_groups.rid
WHERE (( (node.status = '1') AND (node.type IN ('produkt')) ))
ORDER BY node_created DESC
There is no field "rid" in the table field_data_field_customer_groups. Instead there is a "field_customer_groups_rid".
So THIS query DOES work:
SELECT node.created AS node_created, node.nid AS nid
FROM
{node} node
LEFT JOIN {field_data_field_customer_groups} field_data_field_customer_groups ON node.nid = field_data_field_customer_groups.entity_id AND (field_data_field_customer_groups.entity_type = 'node' AND field_data_field_customer_groups.deleted = '0')
LEFT JOIN {role} role_field_data_field_customer_groups ON field_data_field_customer_groups.field_customer_groups_rid = role_field_data_field_customer_groups.rid
WHERE (( (node.status = '1') AND (node.type IN ('produkt')) ))
ORDER BY node_created DESC
Not sure what module's issue this is though.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | role_reference-fixed_issue_with_the_incorrect_request_to_database-2019041-1.patch | 477 bytes | mykhailo.levchenko |
Comments
Comment #1
l0calh0rst commentedMaybe I found it. Please review:
rolereference.module (line 227):
Search:
Replace with:
Comment #2
juliakoelsch commentedThanks, @l0calh0rst! Ran into this issue too, and your change fixed it for me as well.
Comment #3
mykhailo.levchenko commentedCreated patch according to the l0calh0rst's comment.
Comment #5
alex liannoy commentedThank you, everybody.
Closing the issue.
Comment #6
alex liannoy commented