citus icon indicating copy to clipboard operation
citus copied to clipboard

Sequences OWNED BY distributed tables breaks metadata sync if the table has another sequence

Open onderkalaci opened this issue 3 years ago • 0 comments

First, on a distributed table, we do not allow ALTER SEQUENCE "sc1" OWNED BY test.b;

ALTER SEQUENCE "sc1" OWNED BY test.b;
ERROR:  Altering a distributed sequence is currently not supported.

However, if you have such sequences before a table is distributed, and if the same distributed table has a next_val sequence, we just allow distributing such tables. But then, metadata syncing fails:

DROP TABLE IF EXISTS test CASCADE;
DROP SEQUENCE IF EXISTS "sc1","SC1";

CREATE SEQUENCE "SC1";
CREATE SEQUENCE "sc1";

CREATE TABLE test(a int, b int default nextval ('"SC1"'));
SELECT create_distributed_table('test','a');
ALTER SEQUENCE "sc1" OWNED BY test.b;

select start_metadata_sync_to_node('localhost', 9701);                     
ERROR:  relation "public.sc1" does not exist
CONTEXT:  while executing command on localhost:9701

onderkalaci avatar Aug 11 '22 08:08 onderkalaci