enforce not null constraint on shardgroupid for shards

backup/feature/shardgroup
Nils Dijk 2022-10-25 16:18:54 +02:00
parent 303411b9fa
commit 2768b80fd5
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
1 changed files with 6 additions and 1 deletions

View File

@ -46,4 +46,9 @@ WHERE shard.logicalrelid = shardgroup.logicalrelid
shard.shardmaxvalue = shardgroup.shardmaxvalue
OR ( shard.shardmaxvalue IS NULL
AND shardgroup.shardmaxvalue IS NULL)
);
);
-- risky, but we want to fail quickly here. If there are cases where a shard is not associated correctly with a
-- shardgroup we would not want the setup to use the new Citus version as it hard relies on the shardgroups being
-- correctly associated.
ALTER TABLE pg_catalog.pg_dist_shard ALTER COLUMN shardgroupid SET NOT NULL;