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
15eaeace
Commit
15eaeace
authored
Dec 12, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16987 - ALTER DATABASE possible in read-only mode
Forbid ALTER DATABASE under read_only.
parent
32b7d456
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
mysql-test/r/read_only.result
mysql-test/r/read_only.result
+11
-0
mysql-test/t/read_only.test
mysql-test/t/read_only.test
+13
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
No files found.
mysql-test/r/read_only.result
View file @
15eaeace
...
...
@@ -162,3 +162,14 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
drop database mysqltest_db1;
set global read_only= @start_read_only;
#
# MDEV-16987 - ALTER DATABASE possible in read-only mode
#
GRANT ALTER ON test1.* TO user1@localhost;
CREATE DATABASE test1;
SET GLOBAL read_only=1;
ALTER DATABASE test1 CHARACTER SET utf8;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
SET GLOBAL read_only=0;
DROP DATABASE test1;
DROP USER user1@localhost;
mysql-test/t/read_only.test
View file @
15eaeace
...
...
@@ -310,3 +310,16 @@ set global read_only= @start_read_only;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
--
echo
#
--
echo
# MDEV-16987 - ALTER DATABASE possible in read-only mode
--
echo
#
GRANT
ALTER
ON
test1
.*
TO
user1
@
localhost
;
CREATE
DATABASE
test1
;
SET
GLOBAL
read_only
=
1
;
change_user
user1
;
--
error
ER_OPTION_PREVENTS_STATEMENT
ALTER
DATABASE
test1
CHARACTER
SET
utf8
;
change_user
root
;
SET
GLOBAL
read_only
=
0
;
DROP
DATABASE
test1
;
DROP
USER
user1
@
localhost
;
sql/sql_parse.cc
View file @
15eaeace
...
...
@@ -831,6 +831,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
DBUG_RETURN
(
FALSE
);
if
(
lex
->
sql_command
==
SQLCOM_CREATE_DB
||
lex
->
sql_command
==
SQLCOM_ALTER_DB
||
lex
->
sql_command
==
SQLCOM_DROP_DB
)
DBUG_RETURN
(
TRUE
);
...
...
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