mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug mdev-10344.
The patch for bug mdev-9937 actually did not fix the problem of name resolution for tables used in views referred in queries with WITH clauses. This fix corrects the patch.
This commit is contained in:
@ -780,3 +780,26 @@ a
|
||||
2
|
||||
3
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# Bug mdev-10344: the WITH clause of the query refers to a view that uses
|
||||
# a base table with the same name as a CTE table from the clause
|
||||
#
|
||||
create table ten(a int primary key);
|
||||
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table one_k(a int primary key);
|
||||
insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
|
||||
create view v1 as select * from ten;
|
||||
select * from v1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
drop view v1;
|
||||
drop table ten, one_k;
|
||||
|
@ -471,3 +471,21 @@ SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-10344: the WITH clause of the query refers to a view that uses
|
||||
--echo # a base table with the same name as a CTE table from the clause
|
||||
--echo #
|
||||
|
||||
|
||||
create table ten(a int primary key);
|
||||
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
create table one_k(a int primary key);
|
||||
insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
|
||||
|
||||
create view v1 as select * from ten;
|
||||
|
||||
select * from v1;
|
||||
|
||||
drop view v1;
|
||||
drop table ten, one_k;
|
||||
|
@ -1622,7 +1622,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
|
||||
sl->context.error_processor_data= (void *)table;
|
||||
}
|
||||
|
||||
table->select_lex->master_unit()->is_view= true;
|
||||
view_select->master_unit()->is_view= true;
|
||||
|
||||
/*
|
||||
check MERGE algorithm ability
|
||||
|
Reference in New Issue
Block a user