Re: client_encoding issue with SQL_ASCII on 8.3 to 10 upgrade

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: client_encoding issue with SQL_ASCII on 8.3 to 10 upgrade
Date: 2018-04-16 17:37:46
Message-ID: db3a148c-da78-c5d0-a336-1a482538a676@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/16/2018 10:18 AM, Keith Fiske wrote:
>
>

> So playing around with the "client_encoding" configuration option in
> postgresql.conf. According to the docs, setting this should set the
> default encoding for any client that connects, right?

For any client that does not set a client_encoding when it connects.

>
> https://www.postgresql.org/docs/10/static/runtime-config-client.html#GUC-CLIENT-ENCODING
> <https://www.postgresql.org/docs/10/static/runtime-config-client.html#GUC-CLIENT-ENCODING>
>
> That description also seems misleading in saying that the default client
> encoding is what the database encoding is as well. At least as far as
> psql is concerned, right? I've tried setting that value in
> postgresql.conf but psql keeps setting it to UTF8 when I connect to the
> SQL_ASCII database unless I then specifically run "set client_encoding =
> 'SQL_ASCII';"

That is due to this:

https://www.postgresql.org/docs/10/static/app-psql.html

"If both standard input and standard output are a terminal, then psql
sets the client encoding to “auto”, which will detect the appropriate
client encoding from the locale settings (LC_CTYPE environment variable
on Unix systems). If this doesn't work out as expected, the client
encoding can be overridden using the environment variable PGCLIENTENCODING."

If you want to override set the PGCLIENTENCODING env variable to SQL_ASCII.

>
> --
> Keith Fiske
> Senior Database Engineer
> Crunchy Data - http://crunchydata.com

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-04-16 17:57:19 Re: client_encoding issue with SQL_ASCII on 8.3 to 10 upgrade
Previous Message Keith Fiske 2018-04-16 17:18:25 Re: client_encoding issue with SQL_ASCII on 8.3 to 10 upgrade