Wrong result when using SQL_BUFFER_RESULT if min/max loose scan is chosen

Bug #992405 reported by Igor Babaev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Medium
Timour Katchaounov

Bug Description

The following sequence of commands brings us to a wrong result in MariaDB 5.2 :

CREATE TABLE t1 (a int, b varchar(1), KEY (b,a) );
INSERT INTO t1 VALUES (1,NULL),(0,'a');
SINSERT INTO t1 VALUES (2,'x'),(0,'y');
SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;

MariaDB [test]> SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
+--------+------+
| MIN(a) | b |
+--------+------+
| NULL | NULL |
+--------+------+

The result is correct without the modifier SQL_BUFFER_RESULT:

MariaDB [test]> SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
+--------+------+
| MIN(a) | b |
+--------+------+
| 0 | a |
+--------+------+

(See also bug #12640437 for mysql-5.6)

Related branches

Changed in maria:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Timour Katchaounov (timour)
milestone: none → 5.2
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.