Bug #99359 Order by in group_concat with prepare statement returns unexpected results

Submitted: 26 Apr 2020 10:57 Modified: 27 Apr 2020 12:41
Reporter: Feng Liyuan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S3 (Non-critical)
Version:5.6.47, 5.7.29, 8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[26 Apr 2020 10:57] Feng Liyuan
Description:
Order by in group_concat with prepare statement and column positions returns different results.

How to repeat:
drop table if exists test;
create table test(id int, name int);
insert into test values(1, 10);
insert into test values(1, 20);
insert into test values(1, 30);
insert into test values(2, 20);
insert into test values(3, 200);
insert into test values(3, 500);

prepare s1 from "select group_concat(name, id ORDER BY ? desc, name) from test";

set @a=3;
execute s1 using @a;   -- returns error, as expected

set @a=2;
execute s1 using @a;

set @a=3;
execute s1 using @a;   -- unexpected, should returns error like before
[27 Apr 2020 12:41] MySQL Verification Team
Hello Feng Liyuan,

Thank you for the report and feedback.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.