mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	storage/innobase/handler/handler0alter.cc: for NEWDATE key_type says unsigned, thus col->prtype says unsigned, but field->flags says signed. Use the same flag for value retrieval that was used for value storage.
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| --source include/have_innodb.inc
 | |
| # This is the test for bug #47621, column rename operation should
 | |
| # not result in column definition inconsistency between MySQL and
 | |
| # InnoDB
 | |
| 
 | |
| 
 | |
| CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
 | |
| 
 | |
| # Change the column name
 | |
| ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
 | |
| 
 | |
| # If there is inconsistency of column name definition
 | |
| # in MySQL or InnoDB, following create index would fail
 | |
| create index orgs on bug47621(sales_acct_id);
 | |
| 
 | |
| # Change the column name back with the index defined on it.
 | |
| ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
 | |
| 
 | |
| drop table bug47621;
 | |
| 
 | |
| CREATE TABLE bug47621_sale (
 | |
| 	salesperson INT,
 | |
| 	PRIMARY KEY(salesperson)) engine = innodb;
 | |
| 
 | |
| CREATE TABLE bug47621_shirt(
 | |
| 	id SMALLINT,
 | |
| 	owner INT,
 | |
| 	FOREIGN KEY(owner)
 | |
| 		 references bug47621_sale(salesperson) ON DELETE RESTRICT)
 | |
| 	engine = innodb;
 | |
| 
 | |
| insert into bug47621_sale values(9);
 | |
| 
 | |
| insert into bug47621_shirt values(1, 9);
 | |
| 
 | |
| # Any rename operation on columns involved in a reference constraint will
 | |
| # fail, as it will be rejected by InnoDB row_rename_table_for_mysql().
 | |
| # In above example, any rename on column "salesperson" for table
 | |
| # "bug47621_sale", or on column "owner" for table "bug47621_shirt will
 | |
| # be blocked. We do not put such rename in the test since InnoDB error
 | |
| # message will be printed in the error log, and result in test failure.
 | |
| #
 | |
| # ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
 | |
| 
 | |
| # Any rename on columns not involved in the foreign key constraint
 | |
| # could still proceed
 | |
| ALTER TABLE bug47621_shirt CHANGE id new_id INT;
 | |
| 
 | |
| # Referencing table dropped, the rename operation on related columns
 | |
| # could proceed
 | |
| drop table bug47621_shirt;
 | |
| 
 | |
| ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
 | |
| 
 | |
| ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
 | |
| 
 | |
| drop table bug47621_sale;
 |