Bug #115696 MySQL reports a error when group by has a lateral subquery.

Submitted: 26 Jul 2024 6:35 Modified: 1 Oct 2024 16:11
Reporter: Diancheng Wang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:8.0.39, 8.4.2, 9.0.1 OS:Any
Assigned to: CPU Architecture:Any

[26 Jul 2024 6:35] Diancheng Wang
Description:
It reports error message: Duplicate column name 'a'

How to repeat:
following SQL:

create table t1(a int);
select (select ti1.a as c0
                from
                  t1 as ti1,
                  lateral (select to1.a as c00,
                        to1.a as c11
                      from
                        t1 as ti2) as subq_0 limit 1) as c1
      from
        t1 as to1 group by 1;

Note, If remove 'group by 1' from above SQL, the query can be executed successfully.
[26 Jul 2024 7:26] MySQL Verification Team
Hello Diancheng Wang,

Thank you for the report and feedback.

regards,
Umesh
[1 Oct 2024 16:11] Jon Stephens
Documented fix as follows in the MySQL 9.1.0 changelog:

    A GROUP BY query containing a LATERAL subquery raised a spurious
    duplicate column error.

Closed.

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

Page generated in 0.039 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.