mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 05:58:16 +00:00

The pt-online-schema-change tool was not properly handling RENAME COLUMN syntax (MySQL 8.0+), causing renamed columns to be excluded from the data copy operation. This resulted in NULL values for renamed columns after the schema change. The issue was in the find_renamed_cols() function which only supported CHANGE COLUMN syntax but not RENAME COLUMN syntax. Added support for RENAME COLUMN parsing to properly detect column renames and include them in the common_cols list for data copying. Fixes: PT-2418
19 lines
680 B
SQL
19 lines
680 B
SQL
-- Test case for timestamp NULL issue during column rename
|
|
-- This reproduces the issue where 't' column values become NULL after CHANGE COLUMN
|
|
|
|
DROP DATABASE IF EXISTS test;
|
|
CREATE DATABASE test;
|
|
USE test;
|
|
|
|
CREATE TABLE `joinit` (
|
|
`i` int(11) NOT NULL AUTO_INCREMENT,
|
|
`s` varchar(64) DEFAULT NULL,
|
|
`t1` time DEFAULT NULL,
|
|
`g` int(11) NOT NULL,
|
|
PRIMARY KEY (`i`)
|
|
);
|
|
|
|
-- Insert initial data with timestamps
|
|
INSERT INTO joinit VALUES (NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )));
|
|
INSERT INTO joinit SELECT NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )) FROM joinit;
|
|
INSERT INTO joinit SELECT NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )) FROM joinit; |