| Bug #120149 | Unexpected row loss with JSON_ARRAY when replacing aggregation with constant in DISTINCTROW query | ||
|---|---|---|---|
| Submitted: | 25 Mar 7:49 | Modified: | 25 Mar 19:36 |
| Reporter: | Wang Ojiken | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server: JSON | Severity: | S3 (Non-critical) |
| Version: | 9.6.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | distinct, GROUP BY, json_array, Optimizer, wrong result | ||
[25 Mar 7:49]
Wang Ojiken
[25 Mar 19:36]
Roy Lyseng
Thank you for the bug report. Verified as duplicate of bug#120142.
[25 Mar 20:28]
Jean-François Gagné
I think it is useful to add that this also affects 8.0.45 and 8.4.8, see repro below. I am also curious how much this is related to Bug#110556. ./use test <<< ' DROP TABLE IF EXISTS t7; CREATE TABLE t7(c0 INT NULL); INSERT INTO t7 VALUES (0), (NULL); SELECT version(); SELECT DISTINCTROW IFNULL(SUM(c0), 0), JSON_ARRAY(c0) FROM t7 GROUP BY t7.c0; SELECT DISTINCTROW 0, JSON_ARRAY(c0) FROM t7 GROUP BY t7.c0;' version() 8.0.45 IFNULL(SUM(c0), 0) JSON_ARRAY(c0) 0 [0] 0 [null] 0 JSON_ARRAY(c0) 0 [0] version() 8.4.8 IFNULL(SUM(c0), 0) JSON_ARRAY(c0) 0 [0] 0 [null] 0 JSON_ARRAY(c0) 0 [0] version() 9.6.0 IFNULL(SUM(c0), 0) JSON_ARRAY(c0) 0 [0] 0 [null] 0 JSON_ARRAY(c0) 0 [0]
