For me using backticks around table name helped:
ALTER TABLE `my_table` ADD IF NOT EXISTS PARTITION ...