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
370edf06
Commit
370edf06
authored
Oct 21, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow inheriting check options if view have not WHERE clause (BUG#5988)
parent
84d4c4eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
mysql-test/r/view.result
mysql-test/r/view.result
+7
-0
mysql-test/t/view.test
mysql-test/t/view.test
+11
-0
sql/table.cc
sql/table.cc
+7
-4
No files found.
mysql-test/r/view.result
View file @
370edf06
...
@@ -1528,3 +1528,10 @@ substring_index(t,':',2)
...
@@ -1528,3 +1528,10 @@ substring_index(t,':',2)
12:24
12:24
drop view v1;
drop view v1;
drop table t1;
drop table t1;
create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option;
create view v2 as select * from v1 with cascaded check option;
insert into v2 values (0);
ERROR HY000: CHECK OPTION failed 'test.v2'
drop view v2, v1;
drop table t1;
mysql-test/t/view.test
View file @
370edf06
...
@@ -1471,3 +1471,14 @@ select substring_index(t,':',2) from t1;
...
@@ -1471,3 +1471,14 @@ select substring_index(t,':',2) from t1;
select
substring_index
(
t
,
':'
,
2
)
from
v1
;
select
substring_index
(
t
,
':'
,
2
)
from
v1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
# test of cascaded check option for whiew without WHERE clause
#
create
table
t1
(
s1
tinyint
);
create
view
v1
as
select
*
from
t1
where
s1
<>
0
with
local
check
option
;
create
view
v2
as
select
*
from
v1
with
cascaded
check
option
;
--
error
1369
insert
into
v2
values
(
0
);
drop
view
v2
,
v1
;
drop
table
t1
;
sql/table.cc
View file @
370edf06
...
@@ -1586,14 +1586,16 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
...
@@ -1586,14 +1586,16 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
field_translation
=
transl
;
field_translation
=
transl
;
/* TODO: sort this list? Use hash for big number of fields */
/* TODO: sort this list? Use hash for big number of fields */
if
(
where
)
if
(
where
||
(
effective_with_check
==
VIEW_CHECK_CASCADED
&&
ancestor
->
check_option
))
{
{
Item_arena
*
arena
=
thd
->
current_arena
,
backup
;
Item_arena
*
arena
=
thd
->
current_arena
,
backup
;
TABLE_LIST
*
tbl
=
this
;
TABLE_LIST
*
tbl
=
this
;
if
(
arena
->
is_conventional
())
if
(
arena
->
is_conventional
())
arena
=
0
;
// For easier test
arena
=
0
;
// For easier test
if
(
!
where
->
fixed
&&
where
->
fix_fields
(
thd
,
ancestor
,
&
where
))
if
(
where
&&
!
where
->
fixed
&&
where
->
fix_fields
(
thd
,
ancestor
,
&
where
))
goto
err
;
goto
err
;
if
(
arena
)
if
(
arena
)
...
@@ -1601,7 +1603,8 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
...
@@ -1601,7 +1603,8 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
if
(
effective_with_check
)
if
(
effective_with_check
)
{
{
check_option
=
where
->
copy_andor_structure
(
thd
);
if
(
where
)
check_option
=
where
->
copy_andor_structure
(
thd
);
if
(
effective_with_check
==
VIEW_CHECK_CASCADED
)
if
(
effective_with_check
==
VIEW_CHECK_CASCADED
)
{
{
check_option
=
and_conds
(
check_option
,
ancestor
->
check_option
);
check_option
=
and_conds
(
check_option
,
ancestor
->
check_option
);
...
@@ -1612,7 +1615,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
...
@@ -1612,7 +1615,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
check that it is not VIEW in which we insert with INSERT SELECT
check that it is not VIEW in which we insert with INSERT SELECT
(in this case we can't add view WHERE condition to main SELECT_LEX)
(in this case we can't add view WHERE condition to main SELECT_LEX)
*/
*/
if
(
!
no_where_clause
)
if
(
where
&&
!
no_where_clause
)
{
{
/* Go up to join tree and try to find left join */
/* Go up to join tree and try to find left join */
for
(;
tbl
;
tbl
=
tbl
->
embedding
)
for
(;
tbl
;
tbl
=
tbl
->
embedding
)
...
...
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