[MDEV-24083] Contrary to documentation, DDL for temp tables doesn't work inside read-only transactions Created: 2020-11-01  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0, 10.1, 10.3.25, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Dean Trower Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux, WHM


Issue Links:
Relates
relates to MDEV-24082 Can't update a temporay table joined ... Confirmed

 Description   

According to the documentation for "START TRANSACTION":

READ ONLY mode allows the storage engine to apply optimizations that cannot be used for transactions which write data. The only exception to this rule is that read only transactions can perform DDL statements on temporary tables.

Except it doesn't work:

SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION READ ONLY;
 
CREATE TEMPORARY TABLE t (id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,val int unsigned NOT NULL);
INSERT INTO t (val) VALUES (22),(96),(47),(5),(22);
SELECT * FROM t;
DROP TEMPORARY TABLE t;
 
COMMIT;

...Fails with "#1792 - Cannot execute statement in a READ ONLY transaction" on the CREATE TEMPORARY TABLE statement.



 Comments   
Comment by Alice Sherepa [ 2020-11-02 ]

Thank you! I repeated on 10.0-10.5, works as expected with read_only=1, but does not work with tx_read_only=1;

Generated at Thu Feb 08 09:27:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.