mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	On an error (such as when an index cannot be dropped due to
FOREIGN KEY constraints), the field dict_index_t::to_be_dropped
was only being cleared in debug builds, even though the field
is available and being used also in non-debug builds.
This was a regression that was introduced by myself originally
in MySQL 5.7.6 and later merged to MariaDB 10.2.2, in
d39898de8e
An error manifested itself in the MariaDB Server 10.4 non-debug build,
involving instant ADD or DROP column. Because an earlier failed
ALTER TABLE operation incorrectly left the dict_index_t::to_be_dropped
flag set, the column pointers of the index fields would fail to be
adjusted for instant ADD or DROP column (MDEV-15562). The instant
ADD COLUMN in MariaDB Server 10.3 is unlikely to be affected by a
similar scenario, because dict_table_t::instant_add_column() in 10.3
is applying the transformations to all indexes, not skipping
to-be-dropped ones.
		
	
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| --source include/have_innodb.inc
 | |
| #
 | |
| # MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error
 | |
| #
 | |
| set @@sql_mode=strict_trans_tables;
 | |
| create table t1(a text not null) row_format=dynamic engine=innodb;
 | |
| create index idx1 on t1(a(3073));
 | |
| show create table t1;
 | |
| drop table t1;
 | |
| set @@sql_mode=default;
 | |
| 
 | |
| #
 | |
| # MDEV-14081 ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2
 | |
| #
 | |
| create table t1 (
 | |
|   id1    int(11)      not null auto_increment,
 | |
|   id2    varchar(30)  not null,
 | |
|   id3    datetime     not null default current_timestamp,
 | |
|   primary key (id1),
 | |
|   unique key unique_id2 (id2)
 | |
| ) engine=innodb;
 | |
| alter table t1 change column id2 id4 varchar(100) not null;
 | |
| select * from t1 where id4 like 'a';
 | |
| drop table t1;
 | |
| 
 | |
| --echo #
 | |
| --echo # MDEV-17725 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status upon ALTER failing due to error from engine
 | |
| --echo #
 | |
| 
 | |
| SET sql_mode=STRICT_ALL_TABLES;
 | |
| CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
 | |
| ALTER TABLE t1 ORDER BY a;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| SET sql_mode='';
 | |
| CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
 | |
| ALTER TABLE t1 ORDER BY a;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| SET sql_mode=DEFAULT;
 | |
| 
 | |
| --echo #
 | |
| --echo # MDEV-18775 Server crashes in dict_table_t::instant_column
 | |
| --echo # upon ADD COLUMN
 | |
| --echo #
 | |
| 
 | |
| CREATE TABLE tx (pk INT PRIMARY KEY) ENGINE=InnoDB;
 | |
| CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a), FOREIGN KEY (a) REFERENCES tx (pk)) ENGINE=InnoDB;
 | |
| 
 | |
| SET FOREIGN_KEY_CHECKS=OFF;
 | |
| 
 | |
| --error ER_FK_COLUMN_CANNOT_DROP
 | |
| ALTER TABLE t1 DROP a;
 | |
| 
 | |
| SET FOREIGN_KEY_CHECKS=ON;
 | |
| 
 | |
| ALTER TABLE t1 ADD b INT;
 | |
| --error ER_DROP_INDEX_FK
 | |
| ALTER TABLE t1 DROP a;
 | |
| ALTER TABLE t1 ADD c INT;
 | |
| DROP TABLE t1, tx;
 |