mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-30 04:26:45 +03:00 
			
		
		
		
	Problem: ALTER TABLE ADD INDEX may lead to table copying if there's
numeric field(s) with non-default display width modificator specified.
Fix: compare numeric field's storage lenghts when we decide whether 
they can be considered 'equal' for table alteration purposes.
mysql-test/r/error_simulation.result:
  Fix for bug#50946: fast index creation still seems to copy the table
    - test result.
mysql-test/t/error_simulation.test:
  Fix for bug#50946: fast index creation still seems to copy the table
    - test case.
sql/field.cc:
  Fix for bug#50946: fast index creation still seems to copy the table
    - check numeric field's pack lengths instead of it's display lenghts
  comparing fields equality for table alteration purposes.
sql/sql_table.cc:
  Fix for bug#50946: fast index creation still seems to copy the table
    - check compare_tables() result for testing purposes.
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| -- source include/have_debug.inc
 | |
| 
 | |
| #
 | |
| # Bug #28499: crash for grouping query when tmp_table_size is too small
 | |
| #
 | |
| 
 | |
| DROP TABLE IF EXISTS t1;
 | |
| 
 | |
| CREATE TABLE t1 (
 | |
|   a varchar(32) character set utf8 collate utf8_bin NOT NULL,
 | |
|   b varchar(32) character set utf8 collate utf8_bin NOT NULL )
 | |
| ENGINE=MyISAM DEFAULT CHARSET=utf8;
 | |
| 
 | |
| INSERT INTO t1 VALUES
 | |
|   ('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '),
 | |
|   ('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'),
 | |
|   ('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'),
 | |
|   ('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'),
 | |
|   ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
 | |
|   ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
 | |
| 
 | |
| set tmp_table_size=1024;
 | |
| 
 | |
| # Set debug flag so an error is returned when
 | |
| # tmp table in query is converted from heap to myisam
 | |
| set session debug="d,raise_error";
 | |
| 
 | |
| --replace_regex /in table '[^']+'/in table 'tmp_table'/
 | |
| --error ER_DUP_KEY
 | |
| SELECT MAX(a) FROM t1 GROUP BY a,b;
 | |
| 
 | |
| set tmp_table_size=default;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| 
 | |
| --echo #
 | |
| --echo # Bug #50946: fast index creation still seems to copy the table
 | |
| --echo #
 | |
| CREATE TABLE t1 (a INT(100) NOT NULL);
 | |
| INSERT INTO t1 VALUES (1), (0), (2);
 | |
| SET SESSION debug='+d,alter_table_only_index_change';
 | |
| ALTER TABLE t1 ADD INDEX a(a);
 | |
| SET SESSION debug=DEFAULT;
 | |
| SHOW CREATE TABLE t1;
 | |
| SELECT * FROM t1;
 | |
| DROP TABLE t1;
 | |
| 
 | |
| 
 | |
| --echo #
 | |
| --echo # End of 5.1 tests
 | |
| --echo #
 |