Bug #103665 The aliases interferes despite the fact that the database is specified

Submitted: 12 May 2021 5:48 Modified: 12 May 2021 7:52
Reporter: Владислав Сокол Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:8.0.23, 5.7.34, 8.0.24 OS:Any
Assigned to: CPU Architecture:Any

[12 May 2021 5:48] Владислав Сокол
Description:
The tables are not distinguished correctly when their aliases are the same despite the fact that the database is explicitly specified.

How to repeat:
CREATE DATABASE db1;
CREATE TABLE db1.t(a INT);
INSERT INTO db1.t VALUES (1);

mysql> UPDATE db1.t, (SELECT 1 AS a) AS t SET db1.t.a=2;
Query OK, 1 rows affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> UPDATE (SELECT 1 AS a) AS t, db1.t SET db1.t.a=2;
ERROR 1288 (HY000): The target table t of the UPDATE is not updatable

Suggested fix:
Assign unique alias to each table in a query.
[12 May 2021 7:52] MySQL Verification Team
Hello Владислав Сокол,

Thank you for the report and feedback.

regards,
Umesh
[14 May 2021 6:09] MySQL Verification Team
Bug #103694 marked as duplicate of this one

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

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