[MDEV-9419] CREATE TABLE succeeds w/ read_only mode enabled. Created: 2016-01-14  Updated: 2022-11-06  Resolved: 2022-11-06

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Temporary
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 10.1.26, 5.5.57, 10.0.32, 10.2.8

Type: Bug Priority: Major
Reporter: Michael Eddy Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: upstream-fixed
Environment:

Red Hat Enterprise Linux Server release 6.5 (Santiago)
Linux 2.6.32-431.46.2.el6.x86_64 #1 SMP Mon Dec 15 14:20:02 EST 2014 x86_64 x86_64 x86_64 GNU/Linux


Attachments: PNG File image-2022-09-30-14-37-18-339.png     PNG File screenshot-1.png     PNG File screenshot-2.png    

 Description   

When the server is running in read_only mode, and when connected as a user that does not have the SUPER privilege, it is possible to create a real table if a temporary table with the same name already exists.

MariaDB [test]> CREATE TABLE test1 (id INT);
ERROR 1290 (HY000): The MariaDB server is running with the --read-only option so it cannot execute this statement
 
MariaDB [test]> CREATE TEMPORARY TABLE test1 (id INT);
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> CREATE TABLE test1 (id INT);
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [test]> DROP TEMPORARY TABLE test1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> DESCRIBE test1;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

As you can see, the real table persists.

Incidentally, this happens both when binary logging is enabled and when it is not.



 Comments   
Comment by Elena Stepanova [ 2016-01-17 ]

Thanks for the report.

Also reproducible on MySQL 5.5 and 5.6, fixed in 5.7, apparently in the scope of Bug #64992

Comment by kurt.ding [ 2022-09-30 ]

I check it in mysql8.0 and mariadb10.11 , and this issue is fixed.
mysql:

mariadb:

Comment by kurt.ding [ 2022-09-30 ]

And I check the git history . Here is bug number, so I make a conclusion that this issue has been fixed already.
Mysql: BUG#13969578 mariadb: BUG#25250768

Comment by kurt.ding [ 2022-09-30 ]

This solution is add check before finding the table name in temp table list

Comment by Sergei Golubchik [ 2022-11-06 ]

Thanks! Closed.

Generated at Thu Feb 08 07:34:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.