Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?
Date
Msg-id 10708.1321043679@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
Peter Eisentraut <peter_e@gmx.net> writes:
> On tor, 2011-11-10 at 19:30 -0500, Tom Lane wrote:
>> I think psql only pays attention to its locale when stdout is a tty.
>> Now *why* it acts like that, I'll leave for Peter to defend.

> We would have to review the original discussion about that.  I can see
> arguments for doing it that way and for not doing it that way.

> This, however, still doesn't explain why a ALTER ROLE ... SET
> client_encoding is not taking effect.  After all, a plain SET
> client_encoding still works.

The ALTER ROLE *does* take effect ... and then psql overrides it from
the environment.  Not sure why you expected differently --- psql doesn't
especially care why the server sent the initial client_encoding that it
did.

BTW, I noticed while experimenting with this that if I have an
environment of LANG="C", psql overrides the client_encoding to be
SQL_ASCII, regardless of what the database encoding is.  This seems
like a bad idea, since it removes knowledge rather than adding any.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?
Next
From: alextc
Date:
Subject: Re: BUG #4335: Error w/ PostgreSQL & EnterpriseDB Stack Builder