Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
df98f69f
Commit
df98f69f
authored
Apr 23, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug8490-2
parents
2e48fc53
b9ada358
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
+43
-3
mysql-test/r/view.result
mysql-test/r/view.result
+18
-0
mysql-test/t/view.test
mysql-test/t/view.test
+14
-0
sql/sql_view.cc
sql/sql_view.cc
+11
-3
No files found.
mysql-test/r/view.result
View file @
df98f69f
...
...
@@ -1694,3 +1694,21 @@ col1 col2 col2 col3
5 david NULL NULL
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
create table t1 as select 1 A union select 2 union select 3;
create table t2 as select * from t1;
create view v1 as select * from t1 where a in (select * from t2);
select * from v1 A, v1 B where A.a = B.a;
A A
1 1
2 2
3 3
create table t3 as select a a,a b from t2;
create view v2 as select * from t3 where
a in (select * from t1) or b in (select * from t2);
select * from v2 A, v2 B where A.a = B.b;
a b a b
1 1 1 1
2 2 2 2
3 3 3 3
drop view v1, v2;
drop table t1, t2, t3;
mysql-test/t/view.test
View file @
df98f69f
...
...
@@ -1519,3 +1519,17 @@ SELECT a.col1,a.col2,b.col2,b.col3
DROP
VIEW
v1
,
v2
,
v3
;
DROP
TABLE
t1
,
t2
;
# BUG#8490 Select from views containing subqueries causes server to hang
# forever.
create
table
t1
as
select
1
A
union
select
2
union
select
3
;
create
table
t2
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
where
a
in
(
select
*
from
t2
);
select
*
from
v1
A
,
v1
B
where
A
.
a
=
B
.
a
;
create
table
t3
as
select
a
a
,
a
b
from
t2
;
create
view
v2
as
select
*
from
t3
where
a
in
(
select
*
from
t1
)
or
b
in
(
select
*
from
t2
);
select
*
from
v2
A
,
v2
B
where
A
.
a
=
B
.
b
;
drop
view
v1
,
v2
;
drop
table
t1
,
t2
,
t3
;
sql/sql_view.cc
View file @
df98f69f
...
...
@@ -796,17 +796,25 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
/* Store WHERE clause for post-processing in setup_ancestor */
table
->
where
=
view_select
->
where
;
/*
Add subqueries units to SELECT in which we merging current view.
Add subqueries units to SELECT into which we merging current view.
unit(->next)* chain starts with subqueries that are used by this
view and continues with subqueries that are used by other views.
We must not add any subquery twice (otherwise we'll form a loop),
to do this we remember in end_unit the first subquery that has
been already added.
NOTE: we do not support UNION here, so we take only one select
*/
SELECT_LEX_NODE
*
end_unit
=
table
->
select_lex
->
slave
;
for
(
SELECT_LEX_UNIT
*
unit
=
lex
->
select_lex
.
first_inner_unit
();
unit
;
unit
=
unit
->
next_unit
())
{
SELECT_LEX_NODE
*
save_slave
=
unit
->
slave
;
if
(
unit
==
end_unit
)
break
;
unit
->
include_down
(
table
->
select_lex
);
unit
->
slave
=
save_slave
;
// fix include_down initialisation
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment