Steps to reproduce:

* install views, views_ui, and field_ui

* create a content type with a file field

* create a view and FIRST add the file field to it

* NEXT switch on aggregation in the advanced settings.

The view now generates broken SQL, by trying to select a non-existent node__{field_id}.{field_id]_ column for grouping.

The broken state is only reached by enabling aggregation after the field is already created. Adding the field after aggregation is enabled will initialise the column correctly, and saving the aggregation settings at least once will fix the problem.

Comments

cburschka created an issue. See original summary.

cburschka’s picture

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node__field_image.field_image_' in 'field list': SELECT node_field_data.title AS node_field_data_title, node__field_image.field_image_ AS node__field_image_field_image_, node_field_data.created AS node_field_data_created, MIN(node_field_data.nid) AS nid FROM {node_field_data} node_field_data LEFT JOIN {node__field_file} node__field_file ON node_field_data.nid = node__field_file.entity_id AND (node__field_file.deleted = :views_join_condition_0 AND node__field_file.langcode = node_field_data.langcode) LEFT JOIN {node__field_image} node__field_image ON node_field_data.nid = node__field_image.entity_id AND (node__field_image.deleted = :views_join_condition_2 AND node__field_image.langcode = node_field_data.langcode) WHERE (( (node_field_data.status = :db_condition_placeholder_4) )) GROUP BY node_field_data_title, node__field_image_field_image_, node_field_data_created ORDER BY node_field_data_created DESC LIMIT 11 OFFSET 0; Array ( [:db_condition_placeholder_4] => 1 [:views_join_condition_0] => 0 [:views_join_condition_2] => 0 )
roam2345’s picture

Bump

lendude’s picture

Status: Active » Closed (duplicate)