LoginSignup
8
7

More than 5 years have passed since last update.

Windows で psql から Redshift に接続する時の client_encoding エラーの対処

Posted at

環境

  • Windows 7
  • psql (PostgreSQL) 9.2.2
  • Redshift はローカル環境から接続できるようにセキュリティ設定済み(Security の CIDR/IP に接続元の IP を追加した)

課題になったこと

> psql -h xxx.ap-northeast-1.redshift.amazonaws.com -U username -d dbname -p 5439
psql: FATAL:  invalid value for parameter "client_encoding": "SJIS"

上記のようなエラーが出てしまう。

どうやら UTF-8 しか扱ってくれないらしいが、Windows では Postgresql のクライアントエンコーディングの自動判定で常に SJIS と解釈されてしまうらしい。

postgresql.conf で指定するという方法もあるようですが、環境変数に利用するクライアントエンコーディングを指定する事でも解消できた。

set PGCLIENTENCODING=UTF8

もちろん環境変数として永続的に設定しておいても大丈夫です。

8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7