mirror of https://github.com/citusdata/citus.git
Fix metadata sync fails of multi_table_ddl
parent
ae134c209f
commit
ef09ba0d06
|
@ -100,8 +100,9 @@ SELECT create_distributed_table('testserialtable', 'group_id', 'hash');
|
|||
|
||||
(1 row)
|
||||
|
||||
-- can add additional serial columns
|
||||
-- cannot add additional serial columns when metadata is synced
|
||||
ALTER TABLE testserialtable ADD COLUMN other_id serial;
|
||||
ERROR: cannot execute ADD COLUMN commands involving serial pseudotypes when metadata is synchronized to workers
|
||||
-- and we shouldn't be able to change a distributed sequence's owner
|
||||
ALTER SEQUENCE testserialtable_id_seq OWNED BY NONE;
|
||||
ERROR: cannot alter OWNED BY option of a sequence already owned by a distributed table
|
||||
|
@ -115,8 +116,9 @@ HINT: Use a sequence in a distributed table by specifying a serial column type
|
|||
-- or even change a manual sequence to be owned by a distributed table
|
||||
CREATE SEQUENCE standalone_sequence;
|
||||
ALTER SEQUENCE standalone_sequence OWNED BY testserialtable.group_id;
|
||||
-- an edge case, but it's OK to change an owner to the same distributed table
|
||||
-- cannot even change owner to the same distributed table if the sequence is distributed
|
||||
ALTER SEQUENCE testserialtable_id_seq OWNED BY testserialtable.id;
|
||||
ERROR: Altering a distributed sequence is currently not supported.
|
||||
-- drop distributed table
|
||||
\c - - - :master_port
|
||||
DROP TABLE testserialtable;
|
||||
|
@ -146,7 +148,6 @@ ERROR: cannot execute ALTER TABLE command involving partition column
|
|||
ALTER TABLE test_table ADD COLUMN id2 int DEFAULT nextval('test_sequence_1');
|
||||
ALTER TABLE test_table ALTER COLUMN id2 DROP DEFAULT;
|
||||
ALTER TABLE test_table ALTER COLUMN id2 SET DEFAULT nextval('test_sequence_1');
|
||||
ALTER TABLE test_table ADD COLUMN id3 bigserial;
|
||||
-- shouldn't work since the above operations should be the only subcommands
|
||||
ALTER TABLE test_table ADD COLUMN id4 int DEFAULT nextval('test_sequence_1') CHECK (id4 > 0);
|
||||
ERROR: cannot execute ADD COLUMN .. DEFAULT nextval('..') command with other subcommands/constraints
|
||||
|
@ -157,9 +158,11 @@ HINT: You can issue each subcommand separately
|
|||
ALTER TABLE test_table ALTER COLUMN id3 SET DEFAULT nextval('test_sequence_1'), ALTER COLUMN id2 DROP DEFAULT;
|
||||
ERROR: cannot execute ALTER COLUMN COLUMN .. SET DEFAULT nextval('..') command with other subcommands
|
||||
HINT: You can issue each subcommand separately
|
||||
-- shouldn't work because of metadata syncing
|
||||
ALTER TABLE test_table ADD COLUMN id3 bigserial;
|
||||
ERROR: cannot execute ADD COLUMN commands involving serial pseudotypes when metadata is synchronized to workers
|
||||
ALTER TABLE test_table ADD COLUMN id4 bigserial CHECK (id4 > 0);
|
||||
ERROR: cannot execute ADD COLUMN commands involving serial pseudotypes with other subcommands/constraints
|
||||
HINT: You can issue each subcommand separately
|
||||
ERROR: cannot execute ADD COLUMN commands involving serial pseudotypes when metadata is synchronized to workers
|
||||
DROP TABLE test_table CASCADE;
|
||||
DROP SEQUENCE test_sequence_0;
|
||||
DROP SEQUENCE test_sequence_1;
|
||||
|
|
|
@ -32,9 +32,9 @@ test: ref_citus_local_fkeys
|
|||
test: alter_database_owner
|
||||
|
||||
test: multi_test_catalog_views
|
||||
test: multi_table_ddl
|
||||
test: check_mx
|
||||
test: turn_mx_off
|
||||
test: multi_table_ddl
|
||||
test: multi_sequence_default
|
||||
test: multi_name_lengths
|
||||
test: turn_mx_on
|
||||
|
|
|
@ -68,7 +68,7 @@ SET citus.shard_count TO 2;
|
|||
SET citus.shard_replication_factor TO 1;
|
||||
SELECT create_distributed_table('testserialtable', 'group_id', 'hash');
|
||||
|
||||
-- can add additional serial columns
|
||||
-- cannot add additional serial columns when metadata is synced
|
||||
ALTER TABLE testserialtable ADD COLUMN other_id serial;
|
||||
|
||||
-- and we shouldn't be able to change a distributed sequence's owner
|
||||
|
@ -85,7 +85,7 @@ CREATE SEQUENCE standalone_sequence OWNED BY testserialtable.group_id;
|
|||
CREATE SEQUENCE standalone_sequence;
|
||||
ALTER SEQUENCE standalone_sequence OWNED BY testserialtable.group_id;
|
||||
|
||||
-- an edge case, but it's OK to change an owner to the same distributed table
|
||||
-- cannot even change owner to the same distributed table if the sequence is distributed
|
||||
ALTER SEQUENCE testserialtable_id_seq OWNED BY testserialtable.id;
|
||||
|
||||
-- drop distributed table
|
||||
|
@ -113,12 +113,13 @@ ALTER TABLE test_table ADD COLUMN id2 int DEFAULT nextval('test_sequence_1');
|
|||
ALTER TABLE test_table ALTER COLUMN id2 DROP DEFAULT;
|
||||
ALTER TABLE test_table ALTER COLUMN id2 SET DEFAULT nextval('test_sequence_1');
|
||||
|
||||
ALTER TABLE test_table ADD COLUMN id3 bigserial;
|
||||
|
||||
-- shouldn't work since the above operations should be the only subcommands
|
||||
ALTER TABLE test_table ADD COLUMN id4 int DEFAULT nextval('test_sequence_1') CHECK (id4 > 0);
|
||||
ALTER TABLE test_table ADD COLUMN id4 int, ADD COLUMN id5 int DEFAULT nextval('test_sequence_1');
|
||||
ALTER TABLE test_table ALTER COLUMN id3 SET DEFAULT nextval('test_sequence_1'), ALTER COLUMN id2 DROP DEFAULT;
|
||||
|
||||
-- shouldn't work because of metadata syncing
|
||||
ALTER TABLE test_table ADD COLUMN id3 bigserial;
|
||||
ALTER TABLE test_table ADD COLUMN id4 bigserial CHECK (id4 > 0);
|
||||
|
||||
DROP TABLE test_table CASCADE;
|
||||
|
|
Loading…
Reference in New Issue