我需要将一个分区添加到已经分区的表中。我的代码添加了一个可以容纳一些数据的分区p190409。查询如下:
alter table db.table drop partition future;
alter table db.table add partition (partition p190409 values less than (to_days('2019-04-09 11:50:06')));
alter table db.table add partition (partition future values less than (MAXVALUE));
在mysql客户端上完全正常工作时,通过代码产生以下错误:
您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在'alter table db.table add partition(第1行的分区p190409值较少)附近使用正确的语法
看起来您执行查询时使用的方法只允许一次,所以请立即执行所有查询,逐个执行:
executeUpdate("alter table db.table drop partition future");
executeUpdate("alter table db.table add partition (partition p190409 values less than (to_days('2019-04-09 11:50:06')))");
executeUpdate("table db.table add partition (partition future values less than (MAXVALUE))");