user5594148
user5594148

Reputation: 1

Using pt-online-schema-change to alter table

pt-online-schema-change is not able to alter table. It is failing at the step where it copies rows from the original table to the new table and is throwing the error: copying rows caused a MySQL error 1048: Level: warning Code: 1048 Message: column 'trans_datetime' cannot be null

column definition for 'trans_datetime' from show create table >> trans_datetime datetime DEFAULT NULL

which clearly tells that it can have null values. In fact, all the rows in the table which I am trying to alter is having null for 'trans_datetime'

I am running following pt-osc command:

pt-online-schema-change --recursion-method=none --user=test --password=xxxxx 
  --socket=/mysqldata/mysql.sock --nocheck-replication-filters 
  --nocheck-alter --execute 
  --alter "CHANGE COLUMN id id BIGINT(20) NOT NULL, drop primary key, 
           add primary key (order_id, trans_datetime)"
  D=testing,t=temp_test_table

Please let me know if you need any more info. Any help on this will be highly appreciated

Upvotes: 0

Views: 2067

Answers (0)

Related Questions