1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-25080 Fix incorrect view names in printed queries

When printing Item_direct_view_ref the printed field name must be
complemented with the view name/derived table alias.
For example, for "SELECT a FROM (SELECT a FROM t1) q" field `a`
in the select list must be printed as `q`.`a`.

But if the view was merged then the initial `q` does not make sense
any more so field `a` must be printed  as `t1`.`a`
This commit is contained in:
Oleg Smirnov
2023-02-09 14:09:31 +07:00
committed by Sergei Golubchik
parent b5507c738f
commit 47e29a2ff4
6 changed files with 26 additions and 5 deletions

View File

@ -59,7 +59,7 @@ select * from v1 {
}
},
{
"expanded_query": "/* select#1 */ select t1.a AS a,t1.b AS b from v1"
"expanded_query": "/* select#1 */ select v1.a AS a,v1.b AS b from v1"
}
]
}
@ -230,7 +230,7 @@ select * from (select * from t1 where t1.a=1)q {
}
},
{
"expanded_query": "/* select#1 */ select t1.a AS a,t1.b AS b from (/* select#2 */ select t1.a AS a,t1.b AS b from t1 where t1.a = 1) q"
"expanded_query": "/* select#1 */ select q.a AS a,q.b AS b from (/* select#2 */ select t1.a AS a,t1.b AS b from t1 where t1.a = 1) q"
}
]
}
@ -695,7 +695,7 @@ explain select * from v2 {
}
},
{
"expanded_query": "/* select#1 */ select t2.a AS a from v2"
"expanded_query": "/* select#1 */ select v2.a AS a from v2"
}
]
}