openGauss學習筆記-201 openGauss 數(shù)據(jù)庫運維-常見故障定位案例-執(zhí)行修改表分區(qū)操作時報錯
201.1 執(zhí)行修改表分區(qū)操作時報錯
201.1.1 問題現(xiàn)象
執(zhí)行ALTER TABLE PARTITION時,報錯如下。
ERROR:start value of partition "XX" NOT EQUAL up-boundary of last partition.
201.1.2 原因分析
在同一條ALTER TABLE PARTITION語句中,既存在DROP PARTITION又存在ADD PARTITION時,無論它們在語句中的順序是什么,openGauss總會先執(zhí)行DROP PARTITION再執(zhí)行ADD PARTITION。執(zhí)行完DROP PARTITION刪除末尾分區(qū)后,再執(zhí)行ADD PARTITION操作會出現(xiàn)分區(qū)間隙,導致報錯。
201.1.3 處理辦法
為防止出現(xiàn)分區(qū)間隙,需要將ADD PARTITION的START值前移。示例如下。
--創(chuàng)建分區(qū)表partitiontest。
openGauss=# CREATE TABLE partitiontest
(
c_int integer,
c_time TIMESTAMP WITHOUT TIME ZONE
)
PARTITION BY range (c_int)
(
partition p1 start(100)end(108),
partition p2 start(108)end(120)
);
--使用如下兩種語句會發(fā)生報錯:
openGauss=# ALTER TABLE partitiontest ADD PARTITION p3 start(120)end(130), DROP PARTITION p2;
ERROR: start value of partition "p3" NOT EQUAL up-boundary of last partition.
openGauss=# ALTER TABLE partitiontest DROP PARTITION p2,ADD PARTITION p3 start(120)end(130);
ERROR: start value of partition "p3" NOT EQUAL up-boundary of last partition.
--可以修改語句為:
openGauss=# ALTER TABLE partitiontest ADD PARTITION p3 start(108)end(130), DROP PARTITION p2;
openGauss=# ALTER TABLE partitiontest DROP PARTITION p2,ADD PARTITION p3 start(108)end(130);
?? 點贊,你的認可是我創(chuàng)作的動力!
?? 收藏,你的青睞是我努力的方向!
?? 評論,你的意見是我進步的財富!文章來源:http://www.zghlxwxcb.cn/news/detail-805973.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-805973.html
到了這里,關(guān)于openGauss學習筆記-201 openGauss 數(shù)據(jù)庫運維-常見故障定位案例-執(zhí)行修改表分區(qū)操作時報錯的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!