diff --git a/.changeset/yellow-geckos-mix.md b/.changeset/yellow-geckos-mix.md new file mode 100644 index 00000000..846a56a0 --- /dev/null +++ b/.changeset/yellow-geckos-mix.md @@ -0,0 +1,5 @@ +--- +"@core/electric": patch +--- + +Truncate temporary replication slot name to always fit within Postgres' limit of 63 chars diff --git a/components/electric/lib/electric/replication/postgres/logical_replication_producer.ex b/components/electric/lib/electric/replication/postgres/logical_replication_producer.ex index 4a26694b..ea0e361c 100644 --- a/components/electric/lib/electric/replication/postgres/logical_replication_producer.ex +++ b/components/electric/lib/electric/replication/postgres/logical_replication_producer.ex @@ -111,7 +111,8 @@ defmodule Electric.Replication.Postgres.LogicalReplicationProducer do publication = repl_opts.publication main_slot = repl_opts.slot - tmp_slot = main_slot <> "_rc" + # Ensure temporary slot name fits within Postgres' limit of 63 chars + tmp_slot = String.slice(main_slot, 0..59) <> "_rc" Logger.metadata(pg_producer: origin)