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
9b3360ea
Commit
9b3360ea
authored
Jul 18, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#25250768: WRITING ON A READ_ONLY=ON SERVER WITHOUT SUPER PRIVILEGE
simplify. add a test case.
parent
f6bcdb9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
17 deletions
+14
-17
mysql-test/r/read_only.result
mysql-test/r/read_only.result
+2
-0
mysql-test/t/read_only.test
mysql-test/t/read_only.test
+3
-0
sql/sql_parse.cc
sql/sql_parse.cc
+9
-17
No files found.
mysql-test/r/read_only.result
View file @
9b3360ea
...
...
@@ -30,6 +30,8 @@ create temporary table t3 (a int);
create temporary table t4 (a int) select * from t3;
insert into t3 values(1);
insert into t4 select * from t3;
create table t3 (a int);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
...
...
mysql-test/t/read_only.test
View file @
9b3360ea
...
...
@@ -80,6 +80,9 @@ insert into t3 values(1);
insert
into
t4
select
*
from
t3
;
--
error
ER_OPTION_PREVENTS_STATEMENT
create
table
t3
(
a
int
);
# a non-temp table updated:
--
error
ER_OPTION_PREVENTS_STATEMENT
update
t1
,
t3
set
t1
.
a
=
t3
.
a
+
1
where
t1
.
a
=
t3
.
a
;
...
...
sql/sql_parse.cc
View file @
9b3360ea
...
...
@@ -835,24 +835,16 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
if
(
lex
->
sql_command
==
SQLCOM_UPDATE_MULTI
)
DBUG_RETURN
(
FALSE
);
const
my_bool
create_temp_tables
=
(
lex
->
sql_command
==
SQLCOM_CREATE_TABLE
)
&&
(
lex
->
create_info
.
options
&
HA_LEX_CREATE_TMP_TABLE
);
const
my_bool
create_real_tables
=
(
lex
->
sql_command
==
SQLCOM_CREATE_TABLE
)
&&
!
(
lex
->
create_info
.
options
&
HA_LEX_CREATE_TMP_TABLE
);
const
my_bool
drop_temp_tables
=
(
lex
->
sql_command
==
SQLCOM_DROP_TABLE
)
&&
lex
->
drop_temporary
;
const
my_bool
update_real_tables
=
((
create_real_tables
||
some_non_temp_table_to_be_updated
(
thd
,
all_tables
))
&&
!
(
create_temp_tables
||
drop_temp_tables
));
/*
a table-to-be-created is not in the temp table list yet,
so CREATE TABLE needs a special treatment
*/
const
bool
update_real_tables
=
lex
->
sql_command
==
SQLCOM_CREATE_TABLE
?
!
(
lex
->
create_info
.
options
&
HA_LEX_CREATE_TMP_TABLE
)
:
some_non_temp_table_to_be_updated
(
thd
,
all_tables
);
const
my_
bool
create_or_drop_databases
=
const
bool
create_or_drop_databases
=
(
lex
->
sql_command
==
SQLCOM_CREATE_DB
)
||
(
lex
->
sql_command
==
SQLCOM_DROP_DB
);
...
...
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