Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
12.3, 13.1, 12.3.3
-
Linux/amd64
Description
With group_concat_max_len set to 10 bytes, a one-point ST_COLLECT returns a non-NULL 34-byte result without a warning, while the two-point case returns NULL with warning 1260. This was reproduced on MariaDB 12.3.3 on Linux/amd64.
Run the following statements in one session. No database objects are created, and the original session setting is restored at the end.
SET @saved_concat_limit=@@session.group_concat_max_len; |
SET SESSION group_concat_max_len=10; |
SELECT OCTET_LENGTH(ST_COLLECT(ST_GEOMFROMTEXT('POINT(0 0)'))) AS one_point_len; |
SHOW WARNINGS;
|
SELECT OCTET_LENGTH(ST_COLLECT(g)) AS two_point_len |
FROM ( |
SELECT ST_GEOMFROMTEXT('POINT(0 0)') AS g |
UNION ALL |
SELECT ST_GEOMFROMTEXT('POINT(1 1)') AS g |
) AS points; |
SHOW WARNINGS;
|
SET SESSION group_concat_max_len=@saved_concat_limit; |
The recorded output is:
34
|
NULL
|
Warning 1260 Row 1 was cut by st_collect()
|
The one-point aggregate exceeds the configured limit without producing a warning. The two-point case reaches the existing rejection path only on the following iteration, after the accumulated content is already oversized.
The source-supported explanation is that Item_func_collect::val_str() checks the accumulated content length before appending each geometry. Consequently, the first geometry—or the final geometry appended—can cross the limit without being rejected.
ST_COLLECT must enforce group_concat_max_len when appending every input, including the first input and the input that crosses the boundary. It must not return a non-NULL 34-byte aggregate when the configured limit is 10 bytes.
This occurs when ST_COLLECT aggregates a geometry whose encoded result exceeds group_concat_max_len, including when the first or final input crosses the limit.
Attachments
Issue Links
- relates to
-
MDEV-39982 JSON_OBJECTAGG skips the length limit of group_concat_max_len
-
- Confirmed
-
-
MDEV-40696 JSON_ARRAYAGG returns up to two bytes more than group_concat_max_len, and returns them without a warning when the elements end exactly on the limit
-
- Open
-