Bug #105541 SELECT JSON_ARRAYAGG(DISTINCT ... does not work

Submitted: 12 Nov 2021 9:39 Modified: 16 Nov 2021 12:11
Reporter: Eric BARDOUL Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:8.0.27 OS:MacOS (Monterey 12.0.1)
Assigned to: CPU Architecture:x86 (64 bit)
Tags: JSON_ARRAYAGG

[12 Nov 2021 9:39] Eric BARDOUL
Description:
This SQL

SELECT JSON_ARRAYAGG(DISTINCT `my_col`)
FROM `my_table` 
GROUP `group_col`
;

It work fine when I run it in a query tab. Even if it show a problem in the margin.

But when trying to write this select in a stored procedure, it is impossible to apply until the DISTINT is present in the query.

Error message when clicking on Apply :
The object's DDL statement contains syntax errors.
You cannot modify this object until you fix the errors.

How to repeat:
Try to make a stored procedure withe a JSON_ARRAYAGG(DISTINCT ...)

Suggested fix:
Add the support of DISTINCT for this instruction
[12 Nov 2021 9:41] Eric BARDOUL
The query in query tab

Attachment: Capture d’écran 2021-11-11 à 14.56.14.png (image/png, text), 64.70 KiB.

[12 Nov 2021 9:42] Eric BARDOUL
The error disappear when removing DISTINCT

Attachment: Capture d’écran 2021-11-11 à 14.56.28.png (image/png, text), 60.74 KiB.

[13 Nov 2021 17:38] Eric BARDOUL
Error message in the editor

Attachment: Capture d’écran 2021-11-13 à 18.37.21.png (image/png, text), 89.22 KiB.

[16 Nov 2021 12:11] MySQL Verification Team
Hello Eric BARDOUL,

Thank you for the bug report.
Imho this is duplicate of Bug #91993, please see Bug #91993.

Regards,
Ashwini Patil

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.