Bug #3686 prepared statement, union + group by, inconsistent behaviour during prepare
Submitted: 7 May 2004 12:24 Modified: 12 May 2004 16:18
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.2 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[7 May 2004 12:24] Matthias Leich
Description:
The prepare of
select sum(a) + 200, 1 from t1
union distinct
select sum(a) + 200, 1 from t1
group by b     is successful.

The prepare of
select sum(a) + 200, ? from t1
union distinct
select sum(a) + 200, 1 from t1
group by b      fails with the error
           1140 Mixing of GROUP columns (MIN(),MAX(),COUNT()...)
                 with no GROUP columns is illegal if there is no GROUP BY clause

I do not claim that the statements above make much sense in reality, but
the behaviour of the database server should consistent.

My environment: MySQL 4.1.2 compiled from source tree(last bk pull 07.05.2004)
                Linux (SuSE 9.1)

         

How to repeat:
Please use my attached C source file.

Suggested fix:
The behaviour of the database server should consistent.
[7 May 2004 12:31] Matthias Leich
C source file for the recreation of the problem

Attachment: ps_err2.c (text/plain), 3.50 KiB.

[10 May 2004 12:38] Oleksandr Byelkin
ChangeSet 
  1.1827 04/05/10 13:29:02 bell@sanja.is.com.ua +2 -0 
  treat parameter as constant in ORDER BY check of fields in SELECT list(Bug 
#3686)
[12 May 2004 16:18] Oleksandr Byelkin
Thank you for bugreport. Patch for this bug pushed in our source repository 
and will be present in next server release.