We're updating the issue view to help you get more done. 

Fail to pass update statement when target table has alias

Description

The following update statement can be parsed successfully:

1 2 3 4 5 6 create table t1 (a1 int, b1 int, c1 int); create table t2 (a2 int, b2 int, c2 int); explain update t1 set (a1) = (select y.a2 from t2 y where c1=y.c2) where exists (select 1 from t2 z where z.b2=b1);

However, if we add an alias to the target table t1 as follows, it fails with syntax error which should not:

1 2 3 4 explain update t1 X set (a1) = (select y.a2 from t2 y where b1=y.b2) where exists (select 1 from t2 z where z.b2=x.b1); ERROR 42X04: Column 'T1.A1' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'T1.A1' is not a column in the target table.

Environment

None

Test Plan

None

Status

Assignee

Changli Liu

Reporter

Yi Xia

Labels

Fix Build

None

Doc Impact

None

Time tracking

40h

Epic Link

Components

Sprint

None

Priority

Normal