File: innodb-autoinc-56228.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (46 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--source include/have_innodb.inc
##
# Bug #56228: dropping tables from within an active statement crashes server
#

# This test used to use TEMPORARY TABLE, which before MySQL 5.7 or
# MariaDB Server 10.2 were covered by InnoDB locks.
# In MariaDB Server 10.6, the locking and logging was corrected for Atomic DDL.
# Hence, even if we tweaked create_table_info_t::innobase_table_flags()
# so that TEMPORARY TABLE are created as persistent tables,
# the DROP TEMPORARY TABLE statement inside the function would
# fail due to HA_ERR_LOCK_WAIT_TIMEOUT, instead of breaking locks
# like it used to do before MDEV-26603 and possibly other changes.
CREATE TABLE t1_56228(
	c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2_56228(
	c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;

DELIMITER //;

--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC
BEGIN
 INSERT INTO t1_56228 VALUES(NULL);
 INSERT INTO t2_56228 VALUES(NULL);
 INSERT INTO t1_56228 VALUES(NULL);
 INSERT INTO t2_56228 VALUES(NULL);
 DROP TABLE t1_56228;
 RETURN 42;
END //

CREATE PROCEDURE bug56228()
BEGIN
 INSERT INTO t1_56228 VALUES(NULL);
 INSERT INTO t2_56228 VALUES(NULL);
 INSERT INTO t1_56228 VALUES(NULL);
 INSERT INTO t2_56228 VALUES(NULL);
 DROP TABLE t1_56228;
END //

DELIMITER ;//

CALL bug56228();

DROP PROCEDURE bug56228;
DROP TABLE t2_56228;