Query with GROUP BY returns an extra row

Bug #1001092 reported by Igor Babaev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Confirmed
Medium
Oleksandr "Sanja" Byelkin

Bug Description

The following test case produces a wrong result in MariaDB 5.2:

CREATE TABLE t1 (vc varchar(1), INDEX vc_idx (vc)) ;
INSERT INTO t1 VALUES (NULL), ('o'), (NULL), ('p'), ('c');
FLUSH TABLE t1;
SELECT vc FROM t1 GROUP BY vc;

MariaDB [test]> SELECT vc FROM t1 GROUP BY vc;
+------+
| vc |
+------+
| NULL |
| NULL |
| c |
| o |
| p |
+------+
5 rows in set (0.01 sec)

(See also bug #12837714 in mysql-trunk)

Changed in maria:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin)
milestone: none → 5.2
Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

It is not repeatable on 5.3

Changed in maria:
importance: High → Medium
Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

In 5.3 it was fixed by adding this to Cached_item_field::cmp :

 /*
    If value is not null and value changed (from null to not null or
    becasue of value change), then copy the new value to buffer.
    */
  if (! null_value && (tmp || (tmp= (field->cmp(buff) != 0))))
    field->get_image(buff,length,field->charset());

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.