Postgresql CITUDB:不允许修改行的分区值

Postgresql CITUDB:不允许修改行的分区值,postgresql,citus,Postgresql,Citus,我想基于postgressql使用citus更新或删除测试数据库上的数据,请注意以下信息: 不允许修改行的分区值 城市:6.0 postgresql:9.6 当我使用citus时,如何删除或删除数据?我认为在这种情况下,错误消息有点令人困惑。不允许更新分发键值本身,但是允许使用分发键值更新/删除行。请参见下面的示例: CREATE TABLE test_table (key int, value text); -- distribute the table SELECT create_dist

我想基于postgressql使用citus更新或删除测试数据库上的数据,请注意以下信息: 不允许修改行的分区值 城市:6.0 postgresql:9.6
当我使用citus时,如何删除或删除数据?

我认为在这种情况下,错误消息有点令人困惑。不允许更新分发键值本身,但是允许使用分发键值更新/删除行。请参见下面的示例:

CREATE TABLE test_table (key int, value text);

-- distribute the table
SELECT create_distributed_table('test_table', 'key');

-- insert a row
INSERT INTO test_table VALUES (1, 'some test');

-- get the inserted row
SELECT * FROM test_table WHERE key = 1;

-- now, update the row
UPDATE test_table SET value = 'some another text' WHERE key = 1;

-- get the updated row
SELECT * FROM test_table WHERE key = 1;

-- now delete the row
DELETE FROM test_table WHERE key = 1;

-- see that the row is delete
SELECT * FROM test_table WHERE key = 1;
现在,让我举一个不允许的例子。不允许更新分发键值,因为该行已基于该值放置在碎片上,更新该值可能导致该行不再位于该碎片中

-- insert the row again
INSERT INTO test_table VALUES (1, 'some test');

-- now, try to update the distribution key value
UPDATE test_table SET key = 2 WHERE key = 1;
ERROR:  modifying the partition value of rows is not allowed
希望这有帮助