# Help with pt-online-scheme-channge

**URL:** <https://forums.percona.com/t/help-with-pt-online-scheme-channge/2908>\
**Category:** Percona Toolkit\
**Created:** [August 26, 2013, 10:40am UTC](https://forums.percona.com/t/help-with-pt-online-scheme-channge/2908 "2013-08-26T10:40:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rreddy](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@rreddy](https://forums.percona.com/u/rreddy)\
**Post date:** [August 26, 2013, 10:40am UTC](https://forums.percona.com/t/help-with-pt-online-scheme-channge/2908/1 "2013-08-26T10:40:34Z")

</div>

Hi, I am trying to do the following in one shot using the pt-online-schema-change and it doesn’t seem to work, for some reason, it complains about the syntax error, but there is none as I can split them and run them in two pieces without any changes.

pt-online-schema-change --critical-load Threads\_running=100 --execute -F /root/.my.cnf --alter "  
DROP PRIMARY KEY, ADD CONSTRAINT pk PRIMARY KEY(ID,WHEN\_VIEWED\_TLM), MODIFY ID INT(10) NOT NULL AUTO\_INCREMENT,  
PARTITION BY RANGE(to\_days(WHEN\_VIEWED\_TLM))  
(PARTITION p200703 VALUES LESS THAN (to\_days(‘2007-03-01’)) ENGINE = InnoDB,  
PARTITION p200704 VALUES LESS THAN (to\_days(‘2007-04-01’)) ENGINE = InnoDB,  
PARTITION p200705 VALUES LESS THAN (to\_days(‘2007-05-01’)) ENGINE = InnoDB,  
PARTITION p200706 VALUES LESS THAN (to\_days(‘2007-06-01’)) ENGINE = InnoDB,  
PARTITION pMAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) " D=test,t=T1

I can make “DROP PRIMARY KEY, ADD CONSTRAINT pk PRIMARY KEY(ID,WHEN\_VIEWED\_TLM), MODIFY ID INT(10) NOT NULL AUTO\_INCREMENT” as one group and the partitioning piece as the second.

Is it possible to make all of these changes in one shot or does these need to be split.

Here is the error I get when I try to make all the changes at once.

Error altering new table `test`.`_T1_new`: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘PARTITION BY RANGE(to\_days(WHEN\_VIEWED\_TLM)) (PARTITION p200703 VALUES LESS THAN’ at line 1 at /usr/bin/pt-online-schema-change line 8336.

Thanks in Advance.  
Ramki

---

<div class="post-metadata">

**Author:** ![rreddy](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@rreddy](https://forums.percona.com/u/rreddy)\
**Post date:** [August 28, 2013, 8:36pm UTC](https://forums.percona.com/t/help-with-pt-online-scheme-channge/2908/2 "2013-08-28T20:36:45Z")

</div>

I am all set here, found the solution from one other recent threads on this forum, mistake was I had an extra COMMA.
