@@ -597,9 +597,9 @@ var UpdateScriptTests = []ScriptTest{
597597 },
598598 },
599599 {
600- Dialect : "mysql" ,
601600 // https://github.com/dolthub/dolt/issues/9403
602- Name : "UPDATE join – multiple tables with same column names with triggers" ,
601+ Dialect : "mysql" ,
602+ Name : "UPDATE join – multiple tables with same column names with triggers" ,
603603 SetUpScript : []string {
604604 "create table customers (id int primary key, name text, tier text)" ,
605605 "create table orders (id int primary key, customer_id int, status text)" ,
@@ -632,8 +632,54 @@ var UpdateScriptTests = []ScriptTest{
632632 },
633633 },
634634 {
635- Name : "UPDATE with subquery in keyless tables" ,
635+ Dialect : "mysql" ,
636+ Name : "UPDATE join - conflicting alias in Subquery Alias" ,
637+ SetUpScript : []string {
638+ "create table parent (id int primary key);" ,
639+ "insert into parent values (1), (2), (3);" ,
640+ "create table child (id int primary key, pid int, foreign key (pid) references parent(id), oid int);" ,
641+ "insert into child values (1, 1, 0), (2, 2, 0), (3, 3, 0);" ,
642+ },
643+ Assertions : []ScriptTestAssertion {
644+ {
645+ Query : `
646+ update child t1
647+ left join
648+ (
649+ select
650+ t1.id
651+ from
652+ child t1
653+ ) sqa
654+ on
655+ t1.id = sqa.id
656+ join
657+ child t2
658+ set
659+ t1.oid = t2.pid;` ,
660+ Expected : []sql.Row {
661+ {types.OkResult {
662+ RowsAffected : 3 ,
663+ Info : plan.UpdateInfo {
664+ Matched : 3 ,
665+ Updated : 3 ,
666+ },
667+ }},
668+ },
669+ },
670+ {
671+ Query : "select * from child;" ,
672+ Expected : []sql.Row {
673+ {1 , 1 , 1 },
674+ {2 , 2 , 1 },
675+ {3 , 3 , 1 },
676+ },
677+ },
678+ },
679+ },
680+ {
636681 // https://github.com/dolthub/dolt/issues/9334
682+ Name : "UPDATE with subquery in keyless tables" ,
637683 SetUpScript : []string {
638684 "create table t (i int)" ,
639685 "insert into t values (1)" ,
0 commit comments