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
9d9c9504
Commit
9d9c9504
authored
Oct 04, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
postmerge fix
parent
013512ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
44 deletions
+52
-44
mysql-test/r/view.result
mysql-test/r/view.result
+6
-6
mysql-test/t/view.test
mysql-test/t/view.test
+8
-8
sql/table.cc
sql/table.cc
+38
-30
No files found.
mysql-test/r/view.result
View file @
9d9c9504
...
@@ -1347,8 +1347,8 @@ insert into v1 values(3);
...
@@ -1347,8 +1347,8 @@ insert into v1 values(3);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (2),(3),(0);
insert ignore into v1 values (2),(3),(0);
Warnings:
Warnings:
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
select * from t1;
select * from t1;
a
a
1
1
...
@@ -1361,8 +1361,8 @@ create table t2 (a int);
...
@@ -1361,8 +1361,8 @@ create table t2 (a int);
insert into t2 values (2),(3),(0);
insert into t2 values (2),(3),(0);
insert ignore into v1 SELECT a from t2;
insert ignore into v1 SELECT a from t2;
Warnings:
Warnings:
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
select * from t1;
select * from t1;
a
a
1
1
...
@@ -1384,7 +1384,7 @@ a
...
@@ -1384,7 +1384,7 @@ a
update v1 set a=a+1;
update v1 set a=a+1;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
Warnings:
Warnings:
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
select * from t1;
select * from t1;
a
a
1
1
...
@@ -1418,7 +1418,7 @@ insert into v1 values (1) on duplicate key update a=2;
...
@@ -1418,7 +1418,7 @@ insert into v1 values (1) on duplicate key update a=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (1) on duplicate key update a=2;
insert ignore into v1 values (1) on duplicate key update a=2;
Warnings:
Warnings:
Error 13
59
CHECK OPTION failed 'test.v1'
Error 13
65
CHECK OPTION failed 'test.v1'
select * from t1;
select * from t1;
a
a
1
1
...
...
mysql-test/t/view.test
View file @
9d9c9504
...
@@ -394,7 +394,7 @@ drop table t1;
...
@@ -394,7 +394,7 @@ drop table t1;
# syntax compatibility
# syntax compatibility
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
--
error
13
58
--
error
13
64
create
view
v1
as
select
distinct
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
distinct
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
a
from
t1
WITH
CHECK
OPTION
;
create
view
v2
as
select
a
from
t1
WITH
CASCADED
CHECK
OPTION
;
create
view
v2
as
select
a
from
t1
WITH
CASCADED
CHECK
OPTION
;
...
@@ -1318,7 +1318,7 @@ create table t1 (a int);
...
@@ -1318,7 +1318,7 @@ create table t1 (a int);
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
# simple insert
# simple insert
insert
into
v1
values
(
1
);
insert
into
v1
values
(
1
);
--
error
13
59
--
error
13
65
insert
into
v1
values
(
3
);
insert
into
v1
values
(
3
);
# simple insert with ignore
# simple insert with ignore
insert
ignore
into
v1
values
(
2
),(
3
),(
0
);
insert
ignore
into
v1
values
(
2
),(
3
),(
0
);
...
@@ -1327,7 +1327,7 @@ select * from t1;
...
@@ -1327,7 +1327,7 @@ select * from t1;
delete
from
t1
;
delete
from
t1
;
# INSERT SELECT test
# INSERT SELECT test
insert
into
v1
SELECT
1
;
insert
into
v1
SELECT
1
;
--
error
13
59
--
error
13
65
insert
into
v1
SELECT
3
;
insert
into
v1
SELECT
3
;
# prepare data for next check
# prepare data for next check
create
table
t2
(
a
int
);
create
table
t2
(
a
int
);
...
@@ -1337,7 +1337,7 @@ insert ignore into v1 SELECT a from t2;
...
@@ -1337,7 +1337,7 @@ insert ignore into v1 SELECT a from t2;
select
*
from
t1
;
select
*
from
t1
;
#simple UPDATE test
#simple UPDATE test
update
v1
set
a
=-
1
where
a
=
0
;
update
v1
set
a
=-
1
where
a
=
0
;
--
error
13
59
--
error
13
65
update
v1
set
a
=
2
where
a
=
1
;
update
v1
set
a
=
2
where
a
=
1
;
select
*
from
t1
;
select
*
from
t1
;
# prepare data for next check
# prepare data for next check
...
@@ -1364,12 +1364,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
...
@@ -1364,12 +1364,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
create
view
v3
as
select
*
from
v1
where
a
>
0
with
cascaded
check
option
;
create
view
v3
as
select
*
from
v1
where
a
>
0
with
cascaded
check
option
;
insert
into
v2
values
(
1
);
insert
into
v2
values
(
1
);
insert
into
v3
values
(
1
);
insert
into
v3
values
(
1
);
--
error
13
59
--
error
13
65
insert
into
v2
values
(
0
);
insert
into
v2
values
(
0
);
--
error
13
59
--
error
13
65
insert
into
v3
values
(
0
);
insert
into
v3
values
(
0
);
insert
into
v2
values
(
2
);
insert
into
v2
values
(
2
);
--
error
13
59
--
error
13
65
insert
into
v3
values
(
2
);
insert
into
v3
values
(
2
);
select
*
from
t1
;
select
*
from
t1
;
drop
view
v3
,
v2
,
v1
;
drop
view
v3
,
v2
,
v1
;
...
@@ -1381,7 +1381,7 @@ drop table t1;
...
@@ -1381,7 +1381,7 @@ drop table t1;
create
table
t1
(
a
int
,
primary
key
(
a
));
create
table
t1
(
a
int
,
primary
key
(
a
));
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
--
error
13
59
--
error
13
65
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
ignore
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
ignore
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
select
*
from
t1
;
select
*
from
t1
;
...
...
sql/table.cc
View file @
9d9c9504
...
@@ -1602,40 +1602,48 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
...
@@ -1602,40 +1602,48 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
check_option
=
and_conds
(
check_option
,
ancestor
->
check_option
);
check_option
=
and_conds
(
check_option
,
ancestor
->
check_option
);
}
}
}
}
/* Go up to join tree and try to find left join */
for
(;
tbl
;
tbl
=
tbl
->
embedding
)
/*
{
check that it is not VIEW in which we insert with INSERT SELECT
if
(
tbl
->
outer_join
)
(in this case we can't add view WHERE condition to main SELECT_LEX)
{
*/
/*
if
(
!
no_where_clause
)
Store WHERE condition to ON expression for outer join, because we
can't use WHERE to correctly execute jeft joins on VIEWs and this
expression will not be moved to WHERE condition (i.e. will be clean
correctly for PS/SP)
*/
tbl
->
on_expr
=
and_conds
(
tbl
->
on_expr
,
where
);
break
;
}
}
if
(
tbl
==
0
)
{
{
if
(
outer_join
)
/* Go up to join tree and try to find left join */
for
(;
tbl
;
tbl
=
tbl
->
embedding
)
{
{
/*
if
(
tbl
->
outer_join
)
Store WHERE condition to ON expression for outer join, because we
{
can't use WHERE to correctly execute jeft joins on VIEWs and this
/*
expression will not be moved to WHERE condition (i.e. will be
Store WHERE condition to ON expression for outer join, because
clean correctly for PS/SP)
we can't use WHERE to correctly execute jeft joins on VIEWs and
*/
this expression will not be moved to WHERE condition (i.e. will
on_expr
=
and_conds
(
on_expr
,
where
);
be clean correctly for PS/SP)
*/
tbl
->
on_expr
=
and_conds
(
tbl
->
on_expr
,
where
);
break
;
}
}
}
else
if
(
tbl
==
0
)
{
{
/*
if
(
outer_join
)
It is conds of JOIN, but it will be stored in
{
st_select_lex::prep_where for next reexecution
/*
*/
Store WHERE condition to ON expression for outer join, because
*
conds
=
and_conds
(
*
conds
,
where
);
we can't use WHERE to correctly execute jeft joins on VIEWs and
this expression will not be moved to WHERE condition (i.e. will
be clean correctly for PS/SP)
*/
on_expr
=
and_conds
(
on_expr
,
where
);
}
else
{
/*
It is conds of JOIN, but it will be stored in
st_select_lex::prep_where for next reexecution
*/
*
conds
=
and_conds
(
*
conds
,
where
);
}
}
}
}
}
...
...
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