File: sp_trans_myisam.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (91 lines) | stat: -rw-r--r-- 2,418 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
--source include/force_myisam_default.inc
--source include/have_myisam.inc

#
# BUG#11758414: Default storage_engine not honored when set
#               from within a stored procedure
#
delimiter |;
SELECT @@GLOBAL.default_storage_engine INTO @old_engine|
SET @@GLOBAL.default_storage_engine=InnoDB|
SET @@SESSION.default_storage_engine=InnoDB|
# show defaults at define-time
SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'|
SHOW SESSION VARIABLES LIKE 'default_storage_engine'|
CREATE PROCEDURE bug11758414()
BEGIN
 SET @@GLOBAL.default_storage_engine="MyISAM";
 SET @@SESSION.default_storage_engine="MyISAM";
 # show defaults at execution time / that setting them worked
 SHOW GLOBAL VARIABLES LIKE 'default_storage_engine';
 SHOW SESSION VARIABLES LIKE 'default_storage_engine';
 CREATE TABLE t1 (id int);
 CREATE TABLE t2 (id int) ENGINE=InnoDB;
 # show we're heeding the default (at run-time, not parse-time!)
 SHOW CREATE TABLE t1;
 # show that we didn't break explicit override with ENGINE=...
 SHOW CREATE TABLE t2;
END;
|
CALL bug11758414|
# show that changing defaults within SP stuck
SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'|
SHOW SESSION VARIABLES LIKE 'default_storage_engine'|
DROP PROCEDURE bug11758414|
DROP TABLE t1, t2|
SET @@GLOBAL.default_storage_engine=@old_engine|

--echo # 
--echo # Bug #35877 Update .. WHERE with function, constraint violation, crash 
--echo #  

-- echo # MyISAM test
CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)|
CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)|
INSERT INTO t1_aux VALUES (1,1)|

CREATE FUNCTION f1_two_inserts() returns INTEGER
BEGIN
   INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
   RETURN 1;
END|

-- error ER_BAD_NULL_ERROR
UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|

-- echo # InnoDB test
ALTER TABLE t1_not_null ENGINE = InnoDB|
ALTER TABLE t1_aux ENGINE = InnoDB|

-- error ER_BAD_NULL_ERROR
UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|

DROP TABLE t1_aux, t1_not_null|
DROP FUNCTION f1_two_inserts|

--echo #
--echo # Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
--echo #

--disable_warnings
DROP PROCEDURE IF EXISTS p1|
DROP TABLE IF EXISTS t1|
--enable_warnings

CREATE TABLE t1 (a INT) ENGINE=INNODB|

CREATE PROCEDURE p1()
BEGIN
  TRUNCATE TABLE t1;
END|

LOCK TABLES t1 WRITE|
CALL p1()|
FLUSH TABLES;
UNLOCK TABLES|
CALL p1()|

DROP PROCEDURE p1|
DROP TABLE t1|

delimiter ;|