pt-online-schema-change dry-run doesn't catch missing default value for not null column being added
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Undecided
|
Muhammad Irfan |
Bug Description
When adding a new column to an existing database table that is specified as a not null the dry-run does not catch if there is a missing default value for the column leading one to expect that the execute will run without error.
Original table DDL:
CREATE TABLE `table_name` (
`id` int(11) NOT NULL,
`existing_
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Observe no warnings in the dry-run:
# pt-online-
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Starting a dry run. `schema`
Creating new table...
Created new table schema.
Altering new table...
Altered `schema`
Not creating triggers because this is a dry run.
Not copying rows because this is a dry run.
Not swapping tables because this is a dry run.
Not dropping old table because this is a dry run.
Not dropping triggers because this is a dry run.
Dropping new table...
Dropped new table OK.
Dry run complete. `schema`
Observe error in the executed run:
# pt-online-
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_
Altering `schema`
Creating new table...
Created new table schema.
Altering new table...
Altered `schema`
Creating triggers...
Created triggers OK.
Copying approximately 1 rows...
Dropping triggers...
Dropped triggers OK.
Dropping new table...
Dropped new table OK.
`schema`
Error copying rows from `schema`
Level: Warning
Code: 1364
Message: Field 'new_column_name' doesn't have a default value
Query: INSERT LOW_PRIORITY IGNORE INTO `schema`
Changed in percona-toolkit: | |
assignee: | nobody → Muhammad Irfan (muhammad-irfan) |
status: | New → Confirmed |
Michael,
It verified. For workaround please check this blogpost www.mysqlperfor manceblog. com/2012/ 06/21/pt- online- schema- change- and-default- values/ still it seems to be valid feature request.