Bug #1537 group_by incorrectly work with item which substitute other on fix_fields()
Submitted: 12 Oct 2003 1:11 Modified: 13 Oct 2003 12:25
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[12 Oct 2003 1:11] Oleksandr Byelkin
Description:
Due to incorrect handle of fix_fields of ORDER BY clouse group concat 
incorrectly work with IN/ALL/ANY subqueries and othe Items awhich make 
substitution during fix_fields() 

How to repeat:
+ create table t1 (a int, a1 varchar(10)); 
+ create table t2 (a0 int); 
+ insert into t1 values (0,"a"),(0,"b"),(1,"c"); 
+ insert into t2 values (1),(2),(3); 
+ select  group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1; 
+ group_concat(a1 order by (t1.a IN (select a0 from t2))) 
+ c,b,a 
+ select  group_concat(a1 order by (t1.a)) from t1; 
+ group_concat(a1 order by (t1.a)) 
+ b,a,c 
+ drop table t1, t2; 
 

Suggested fix:
pass correct address of pointer to item on fix_fields() call of ORDER BY items
[12 Oct 2003 6:13] Oleksandr Byelkin
ChangeSet 
  1.1591 03/10/12 16:10:40 bell@laptop.sanja.is.com.ua +3 -0 
  fixed fix_fields() parameters for GROUP_CONCAT() ORDER BY clause 
  (BUG#1537)
[13 Oct 2003 12:25] Oleksandr Byelkin
patch is pushed