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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a4441374
Commit
a4441374
authored
Feb 12, 2008
by
kaa@kaamos.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mbp:src/opt/bug33389/my51-bug25162
into kaamos.(none):/data/src/opt/mysql-5.1-opt
parents
762557cc
bc953966
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
12 deletions
+50
-12
mysql-test/r/view.result
mysql-test/r/view.result
+16
-0
mysql-test/t/view.test
mysql-test/t/view.test
+22
-0
sql/item.cc
sql/item.cc
+12
-12
No files found.
mysql-test/r/view.result
View file @
a4441374
...
...
@@ -3613,6 +3613,22 @@ ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default val
set @@sql_mode=@old_mode;
drop view v1;
drop table t1;
create table t1 (a int, key(a));
create table t2 (c int);
create view v1 as select a b from t1;
create view v2 as select 1 a from t2, v1 where c in
(select 1 from t1 where b = a);
insert into t1 values (1), (1);
insert into t2 values (1), (1);
prepare stmt from "select * from v2 where a = 1";
execute stmt;
a
1
1
1
1
drop view v1, v2;
drop table t1, t2;
End of 5.0 tests.
DROP DATABASE IF EXISTS `d-1`;
CREATE DATABASE `d-1`;
...
...
mysql-test/t/view.test
View file @
a4441374
...
...
@@ -3468,6 +3468,27 @@ set @@sql_mode=@old_mode;
drop
view
v1
;
drop
table
t1
;
#
# Bug #33389: Selecting from a view into a table from within SP or trigger
# crashes server
#
create
table
t1
(
a
int
,
key
(
a
));
create
table
t2
(
c
int
);
create
view
v1
as
select
a
b
from
t1
;
create
view
v2
as
select
1
a
from
t2
,
v1
where
c
in
(
select
1
from
t1
where
b
=
a
);
insert
into
t1
values
(
1
),
(
1
);
insert
into
t2
values
(
1
),
(
1
);
prepare
stmt
from
"select * from v2 where a = 1"
;
execute
stmt
;
drop
view
v1
,
v2
;
drop
table
t1
,
t2
;
--
echo
End
of
5.0
tests
.
#
...
...
@@ -3541,3 +3562,4 @@ DROP TABLE t1;
--
echo
--
echo
End
of
5.1
tests
.
sql/item.cc
View file @
a4441374
...
...
@@ -3947,6 +3947,18 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
else
if
(
!
from_field
)
goto
error
;
if
(
!
outer_fixed
&&
cached_table
&&
cached_table
->
select_lex
&&
context
->
select_lex
&&
cached_table
->
select_lex
!=
context
->
select_lex
)
{
int
ret
;
if
((
ret
=
fix_outer_field
(
thd
,
&
from_field
,
reference
))
<
0
)
goto
error
;
if
(
!
ret
)
return
FALSE
;
outer_fixed
=
1
;
}
/*
if it is not expression from merged VIEW we will set this field.
...
...
@@ -3962,18 +3974,6 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
if
(
from_field
==
view_ref_found
)
return
FALSE
;
if
(
!
outer_fixed
&&
cached_table
&&
cached_table
->
select_lex
&&
context
->
select_lex
&&
cached_table
->
select_lex
!=
context
->
select_lex
)
{
int
ret
;
if
((
ret
=
fix_outer_field
(
thd
,
&
from_field
,
reference
))
<
0
)
goto
error
;
if
(
!
ret
)
return
FALSE
;
outer_fixed
=
1
;
}
set_field
(
from_field
);
if
(
thd
->
lex
->
in_sum_func
&&
thd
->
lex
->
in_sum_func
->
nest_level
==
...
...
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