enova / pgl_ddl_deploy

Transparent Logical DDL Replication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unique_tags trigger on set_configs needs fixing to allow multiple sets with ddl_only_replication

jfinzel opened this issue · comments

The SQL here is buggy in that it doesn't properly allow you to update the set_config which has ddl_only_replication set to false if you have more than one config for the same replication set:

IF NOT NEW.ddl_only_replication AND EXISTS (
    SELECT 1
    FROM pgl_ddl_deploy.set_configs
    WHERE id <> NEW.id
      AND set_name = NEW.set_name
      AND NOT NEW.ddl_only_replication
      AND (create_tags && NEW.create_tags
      OR drop_tags && NEW.drop_tags)) THEN
    RAISE EXCEPTION $$Another set_config already exists for '%' with overlapping create_tags or drop_tags.
    Command tags must only appear once per set_name even if using multiple set_configs, unless you
    are using the ddl_only_replication setting.
    $$, NEW.set_name;
  END IF;

The function needs to also cover NOT NEW.ddl_only_replication where another config does exist with ddl_only_replication as true.

Workaround is to disable/enable the unique_tags trigger prior to update when you have multiple valid set_configs. We will patch this up next release.

Proposed: 546c0d5

Resolved in PR #37