How do I change the default client_encoding in Postgres?

前端 未结 2 910
攒了一身酷
攒了一身酷 2020-12-31 05:26

I\'m trying to change the default value for the client_encoding configuration variable for a PostgreSQL database I\'m running. I want it to be UTF8

2条回答
  •  梦毁少年i
    2020-12-31 05:45

    Did you set client_encoding in postgresql.conf (and reload config or restart)? Make sure it's UTF8 not utf8

    What is the result of cat ~/.psqlrc and cat /etc/psqlrc ?

    I know you're looking for server-side default, but on the client, you can set an OS envvar:

    export PGCLIENTENCODING=UTF8

    to do this for all users (on that machine), put that in /etc/profile

提交回复
热议问题