patternsqlModerate
Postgresql: set default psql client encoding
Viewed 0 times
postgresqlpsqldefaultclientencodingset
Problem
When I connect to a Postgresql DB using
Following this SO answer, I understand that I should change the client encoding accordingly:
Changing the
psql, I often get these messages:=> SELECT * FROM question_view ;
ERROR: character with byte sequence 0xd7 0x9e in encoding "UTF8" has no equivalent in encoding "LATIN1"Following this SO answer, I understand that I should change the client encoding accordingly:
SET client_encoding = 'UTF8';Changing the
client_encoding every time I connect to the DB is cumbersome. Is there a way to permanently configure this setting, either in the .pgpass file or anywhere else?Solution
Is there a way to permanently configure this setting, either in the .pgpass file or anywhere else
Yes there is: it's
See the manual for details: http://www.postgresql.org/docs/current/static/app-psql.html#AEN88713
Yes there is: it's
~/.psqlrc (or %APPDATA%\postgresql\psqlrc.conf in Windows)See the manual for details: http://www.postgresql.org/docs/current/static/app-psql.html#AEN88713
Context
StackExchange Database Administrators Q#71597, answer score: 18
Revisions (0)
No revisions yet.