Allow configuring PostgreSQL lc_messages locale for Electric's replication connection
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
まず、Electric のレプリケーション接続のセットアップと、publication 作成時のエラー処理を特定します。Issue に記載された接続パラメータと重複する publication の照合方法を比較し、そのうえで、提案されたアプローチのどれがプロジェクトに適しているかを判断します。PostgreSQL サーバーの lc_messages が英語以外の場合でも、レプリケーション接続がクラッシュループに入らなくなり、影響を受けるケースがカバレッジされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
Electric matches PostgreSQL error messages by their text content using pattern matching. However, replication connections in PostgreSQL ignore session-level locale settings (ALTER ROLE SET lc_messages and ALTER DATABASE SET lc_messages) and use only the server-level lc_messages from postgresql.conf.
This means that if a PostgreSQL server is configured with a non-English locale, Electric will receive error messages in that language, the pattern match will fail, and Electric will enter an infinite crash loop.
Example
On a PostgreSQL server with Russian locale, the duplicate publication error comes as "публикация "electric_publication_default" уже существует" instead of the expected "publication "electric_publication_default" already exists". The pin operator match fails and Electric raises the error instead of handling it gracefully.
Possible solutions
- Match only by error code, not message text — simplest fix, already proposed in PR #XXXX. Change the pattern from matching on message text to just code and pg_code: duplicate_object / 42710.
- Use CREATE PUBLICATION IF NOT EXISTS — avoids the duplicate error entirely.
- Allow configuring lc_messages via an Electric environment variable (e.g. ELECTRIC_PG_LC_MESSAGES) passed as a connection parameter, so Electric can force English error messages without requiring changes to the PostgreSQL server configuration.
Workaround
Drop the publication before each Electric restart (e.g. via a Kubernetes init container), so Electric always creates it fresh and never encounters the duplicate error.
Environment
Electric version: 1.7.4 / 1.7.5
PostgreSQL version: 18
PostgreSQL locale: Russian (ru_RU.UTF-8)
- 主要言語
- Elixir
- スター
- 1
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
Bug: Table layout and date column are cut off on mobile screens on the Tournaments -> History pageオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
hexlet-codebattle/codebattle#2375 ·
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
wintermeyer/vutuv#2388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
Broadcast API docs say to prepend realtime: to the topic, which breaks delivery対応中かも @mandar1045 が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
phoenixframework/phoenix_live_view#4509 ·
メンテナーはふだん 1 日以内に返信