mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixes for innodb suite, merging tests from 5.6.
Includes 5.6 changesets for: ***** Fix for BUG#13489996 valgrind:conditional jump or move depends on uninitialised values-field_blob. blob_ptr_size was not initialized properly: remove this variable. ***** Bug#14021323 CRASH IN FIELD::SET_NULL WHEN INSERTING ROWS TO NEW TABLE *****
This commit is contained in:
@ -5,9 +5,6 @@
|
||||
# Test that it's not possible to rename columns participating in a
|
||||
# foreign key (either in the referencing or referenced table).
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
@ -21,35 +18,72 @@ INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
# Test renaming the column in the referenced table.
|
||||
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
ALTER TABLE t1 CHANGE a e INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
ALTER TABLE t2 CHANGE a z INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
ALTER TABLE t3 CHANGE a f INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t3 CHANGE b g INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`e` int(11) NOT NULL DEFAULT '0',
|
||||
`c` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`e`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`z` int(11) NOT NULL DEFAULT '0',
|
||||
`c` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`z`),
|
||||
CONSTRAINT `fk1` FOREIGN KEY (`z`) REFERENCES `t1` (`e`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`f` int(11) NOT NULL DEFAULT '0',
|
||||
`g` int(11) DEFAULT NULL,
|
||||
`d` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`f`),
|
||||
KEY `b` (`g`),
|
||||
CONSTRAINT `fk2` FOREIGN KEY (`g`) REFERENCES `t3` (`f`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
|
||||
SELECT f.*, c.*
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS c
|
||||
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FOREIGN f
|
||||
ON c.ID=f.ID
|
||||
WHERE FOR_NAME LIKE 'test/t%';
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE ID FOR_COL_NAME REF_COL_NAME POS
|
||||
test/fk1 test/t2 test/t1 1 0 test/fk1 z e 0
|
||||
test/fk2 test/t3 test/t3 1 0 test/fk2 g f 0
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user