mirror of https://github.com/citusdata/citus.git
Prevent COPY to reference tables from worker nodes
parent
e7c15ecc1f
commit
4def1ca696
|
@ -400,6 +400,12 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
||||||
columnValues = palloc0(columnCount * sizeof(Datum));
|
columnValues = palloc0(columnCount * sizeof(Datum));
|
||||||
columnNulls = palloc0(columnCount * sizeof(bool));
|
columnNulls = palloc0(columnCount * sizeof(bool));
|
||||||
|
|
||||||
|
/* we don't support copy to reference tables from workers */
|
||||||
|
if (partitionMethod == DISTRIBUTE_BY_NONE)
|
||||||
|
{
|
||||||
|
EnsureSchemaNode();
|
||||||
|
}
|
||||||
|
|
||||||
/* load the list of shards and verify that we have shards to copy into */
|
/* load the list of shards and verify that we have shards to copy into */
|
||||||
shardIntervalList = LoadShardIntervalList(tableId);
|
shardIntervalList = LoadShardIntervalList(tableId);
|
||||||
if (shardIntervalList == NIL)
|
if (shardIntervalList == NIL)
|
||||||
|
|
|
@ -108,7 +108,7 @@ SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='mx_table'::regclass;
|
||||||
5
|
5
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- INSERT/UPDATE/DELETE on reference tables
|
-- INSERT/UPDATE/DELETE/COPY on reference tables
|
||||||
SELECT * FROM mx_ref_table ORDER BY col_1;
|
SELECT * FROM mx_ref_table ORDER BY col_1;
|
||||||
col_1 | col_2
|
col_1 | col_2
|
||||||
-------+--------
|
-------+--------
|
||||||
|
@ -126,6 +126,9 @@ DETAIL: Modifications to reference tables are supported only from the schema no
|
||||||
DELETE FROM mx_ref_table WHERE col_1 = -78;
|
DELETE FROM mx_ref_table WHERE col_1 = -78;
|
||||||
ERROR: cannot perform distributed planning for the given modification
|
ERROR: cannot perform distributed planning for the given modification
|
||||||
DETAIL: Modifications to reference tables are supported only from the schema node.
|
DETAIL: Modifications to reference tables are supported only from the schema node.
|
||||||
|
COPY mx_ref_table (col_1, col_2) FROM STDIN WITH (FORMAT 'csv');
|
||||||
|
ERROR: operation is not allowed on this node
|
||||||
|
HINT: Connect to the schema node and run it again.
|
||||||
SELECT * FROM mx_ref_table ORDER BY col_1;
|
SELECT * FROM mx_ref_table ORDER BY col_1;
|
||||||
col_1 | col_2
|
col_1 | col_2
|
||||||
-------+--------
|
-------+--------
|
||||||
|
|
|
@ -80,11 +80,12 @@ INSERT INTO pg_dist_shard SELECT * FROM pg_dist_shard_temp;
|
||||||
SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='mx_table'::regclass;
|
SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='mx_table'::regclass;
|
||||||
|
|
||||||
|
|
||||||
-- INSERT/UPDATE/DELETE on reference tables
|
-- INSERT/UPDATE/DELETE/COPY on reference tables
|
||||||
SELECT * FROM mx_ref_table ORDER BY col_1;
|
SELECT * FROM mx_ref_table ORDER BY col_1;
|
||||||
INSERT INTO mx_ref_table (col_1, col_2) VALUES (-6, 'vestibulum');
|
INSERT INTO mx_ref_table (col_1, col_2) VALUES (-6, 'vestibulum');
|
||||||
UPDATE mx_ref_table SET col_2 = 'habitant' WHERE col_1 = -37;
|
UPDATE mx_ref_table SET col_2 = 'habitant' WHERE col_1 = -37;
|
||||||
DELETE FROM mx_ref_table WHERE col_1 = -78;
|
DELETE FROM mx_ref_table WHERE col_1 = -78;
|
||||||
|
COPY mx_ref_table (col_1, col_2) FROM STDIN WITH (FORMAT 'csv');
|
||||||
SELECT * FROM mx_ref_table ORDER BY col_1;
|
SELECT * FROM mx_ref_table ORDER BY col_1;
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
Loading…
Reference in New Issue