Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?
Date: 2011-11-11 20:34:39
Message-ID: 10708.1321043679@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message alextc 2011-11-12 13:10:55 Re: BUG #4335: Error w/ PostgreSQL & EnterpriseDB Stack Builder
Previous Message Peter Eisentraut 2011-11-11 16:48:24 Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1?