Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
I run this script:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (i INT, d TIME); |
INSERT INTO t1 VALUES (1,'10:20:30'); |
INSERT INTO t1 VALUES (1,'100:20:20'); |
SELECT MIN(d), MAX(d) FROM t1; |
SELECT i, MIN(d), MAX(d) FROM t1 GROUP BY i; |
The first SELECT returns:
+----------+-----------+
|
| MIN(d) | MAX(d) |
|
+----------+-----------+
|
| 10:20:30 | 100:20:20 |
|
+----------+-----------+
|
Looks correct.
The second SELECT returns:
+------+-----------+----------+
|
| i | MIN(d) | MAX(d) |
|
+------+-----------+----------+
|
| 1 | 100:20:20 | 10:20:30 |
|
+------+-----------+----------+
|
Looks wrong. The MIN and MAX values swapped.
The problem happens in this code:
void Item_sum_min_max::update_field() |
{
|
...
|
switch (Item_sum_min_max::type_handler()->cmp_type()) { |
case STRING_RESULT: |
case TIME_RESULT: |
min_max_update_str_field();
|
Notice, it compares TIME values in text format.
Attachments
Issue Links
- causes
-
MDEV-23838 Possibly wrong result or Assertion `0' failed in Item_func_round::native_op
- Closed
- relates to
-
MDEV-23537 Comparison with temporal columns is slow in MariaDB
- Closed
-
MDEV-23551 Performance degratation in temporal literals in 10.4
- Closed