Add tests which check we disallow writes to local tables.

pull/2423/head
Hadi Moshayedi 2018-10-07 00:17:11 -04:00 committed by Marco Slot
parent d56baefe3d
commit 7509c6c8fb
2 changed files with 10 additions and 0 deletions

View File

@ -90,6 +90,12 @@ SELECT * FROM the_table ORDER BY a;
-- we should still disallow writes to local tables -- we should still disallow writes to local tables
INSERT INTO local VALUES (1, 1); INSERT INTO local VALUES (1, 1);
ERROR: cannot execute INSERT in a read-only transaction ERROR: cannot execute INSERT in a read-only transaction
INSERT INTO local SELECT a, b FROM the_table;
ERROR: cannot INSERT rows from a distributed query into a local table
HINT: Consider using CREATE TEMPORARY TABLE tmp AS SELECT ... and inserting from the temporary table.
-- we shouldn't be able to create local tables
CREATE TEMP TABLE local_copy_of_the_table AS SELECT * FROM the_table;
ERROR: cannot execute CREATE TABLE AS in a read-only transaction
\c "port=9070 dbname=regression options='-c\ citus.use_secondary_nodes=always\ -c\ citus.cluster_name=second-cluster'" \c "port=9070 dbname=regression options='-c\ citus.use_secondary_nodes=always\ -c\ citus.cluster_name=second-cluster'"
-- separate follower formations currently cannot do writes -- separate follower formations currently cannot do writes
SET citus.writable_standby_coordinator TO on; SET citus.writable_standby_coordinator TO on;

View File

@ -64,6 +64,10 @@ SELECT * FROM the_table ORDER BY a;
-- we should still disallow writes to local tables -- we should still disallow writes to local tables
INSERT INTO local VALUES (1, 1); INSERT INTO local VALUES (1, 1);
INSERT INTO local SELECT a, b FROM the_table;
-- we shouldn't be able to create local tables
CREATE TEMP TABLE local_copy_of_the_table AS SELECT * FROM the_table;
\c "port=9070 dbname=regression options='-c\ citus.use_secondary_nodes=always\ -c\ citus.cluster_name=second-cluster'" \c "port=9070 dbname=regression options='-c\ citus.use_secondary_nodes=always\ -c\ citus.cluster_name=second-cluster'"