Invalid SQL when aggregation is enabled

Created on 1 October 2013, over 10 years ago
Updated 6 May 2024, about 2 months ago

How to reproduce: Create a node type with field collections with relatively long field names. Create a views, where you add a relationship to the field collection. Enable Aggregation.

Issue: When Aggregation is enabled, somehow the argument of the AS clause are truncated, resulting into an invalid SQL query. Here is my example:

Before aggregation

SELECT node.nid AS nid, field_collection_item_field_data_field_station_livestream.item_id AS field_collection_item_field_data_field_station_livestream_it, node_field_data_field_location_prefecture.nid AS node_field_data_field_location_prefecture_nid, node.title AS node_title, node.language AS node_language, field_collection_item_field_data_field_station_livestream__field_data_field_livestream_bitrate.field_livestream_bitrate_value AS field_collection_item_field_data_field_station_livestream__f, 'node' AS field_data_field_location_prefecture_node_entity_type, 'node' AS field_data_field_station_shortdescription_node_entity_type, 'field_collection_item' AS field_data_field_livestream_url_field_collection_item_entity



After aggregation

SELECT node.nid AS nid, field_collection_item_field_data_field_station_livestream.item_id AS field_collection_item_field_data_field_station_livestream_it, node_field_data_field_location_prefecture__field_data_field_location_prefecture.field_location_prefecture_target_id AS node_field_data_field_location_prefecture__field_data_field_, node.title AS node_title, node.language AS node_language, field_data_field_station_shortdescription.field_station_shortdescription_value AS field_data_field_station_shortdescription_field_station_shor, field_collection_item_field_data_field_station_livestream__field_data_field_livestream_url. AS field_collection_item_field_data_field_station_livestream__f, field_collection_item_field_data_field_station_livestream__field_data_field_livestream_bitrate.field_livestream_bitrate_value AS field_collection_item_field_data_field_station_livestream__f_1, MIN(node_field_data_field_location_prefecture.nid) AS node_field_data_field_location_prefecture_nid, 'node' AS field_data_field_location_prefecture_node_entity_type, MIN(node.nid) AS nid_1, 'node' AS field_data_field_station_shortdescription_node_entity_type, MIN(field_collection_item_field_data_field_station_livestream.item_id) AS field_collection_item_field_data_field_station_livestream_it_1, 'field_collection_item' AS field_data_field_livestream_url_field_collection_item_entity



Error given

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS field_collection_item_field_data_field_station_livestream__f, field_collectio' at line 1

πŸ› Bug report
Status

Closed: outdated

Component

Code

Created by

πŸ‡¬πŸ‡·Greece radiobuzzer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024