Re: client_encoding issue with SQL_ASCII on 8.3 to 10 upgrade

From: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-17 03:24:15
Message-ID: CAODZiv40DERjxJ3zBLmMK8Fx2yZesu5s70kXN4564c4g3uqVSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 16, 2018 at 2:26 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 04/16/2018 10:18 AM, Keith Fiske wrote:
>
>>
>>
>> On Mon, Apr 16, 2018 at 12:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us <mailto:
>> tgl(at)sss(dot)pgh(dot)pa(dot)us>> 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?
>>
>> https://www.postgresql.org/docs/10/static/runtime-config-cli
>> ent.html#GUC-CLIENT-ENCODING <https://www.postgresql.org/do
>> cs/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';"
>>
>
> Realized that while my previous suggestion of setting PGCLIENTENCODING to
> 'SQL_ASCII' would work it would also affect libpq programs beside psql.
>
> For a finer grained approach set \encoding 'SQL_ASCII' in a .psqlrc file.:
>
> https://www.postgresql.org/docs/10/static/app-psql.html
>
> "Files
>
> psqlrc and ~/.psqlrc
>
> Unless it is passed an -X option, psql attempts to read and execute
> commands from the system-wide startup file (psqlrc) and then the user's
> personal startup file (~/.psqlrc), after connecting to the database but
> before accepting normal commands. These files can be used to set up the
> client and/or the server to taste, typically with \set and SET commands.
>
> The system-wide startup file is named psqlrc and is sought in the
> installation's “system configuration” directory, which is most reliably
> identified by running pg_config --sysconfdir. By default this directory
> will be ../etc/ relative to the directory containing the PostgreSQL
> executables. The name of this directory can be set explicitly via the
> PGSYSCONFDIR environment variable.
>
> The user's personal startup file is named .psqlrc and is sought in the
> invoking user's home directory. On Windows, which lacks such a concept, the
> personal startup file is named %APPDATA%\postgresql\psqlrc.conf. The
> location of the user's startup file can be set explicitly via the PSQLRC
> environment variable.
>
> Both the system-wide startup file and the user's personal startup file
> can be made psql-version-specific by appending a dash and the PostgreSQL
> major or minor release number to the file name, for example ~/.psqlrc-9.2
> or ~/.psqlrc-9.2.5. The most specific version-matching file will be read in
> preference to a non-version-specific file.
>
> "
>
>
>> --
>> Keith Fiske
>> Senior Database Engineer
>> Crunchy Data - http://crunchydata.com
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

Adrian,

Thanks for all the info! This will definitely help a lot getting the new
environment set up until we can start working on migrating off SQL_ASCII.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-04-17 04:07:03 Re: pg_dump to a remote server
Previous Message Ron 2018-04-17 01:43:34 Re: pg_dump to a remote server