Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3E3AC156600B for ; Fri, 11 Nov 2011 16:34:49 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 72214-03 for ; Fri, 11 Nov 2011 20:34:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 22477156600A for ; Fri, 11 Nov 2011 16:34:43 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pABKYdRv010709; Fri, 11 Nov 2011 15:34:39 -0500 (EST) To: Peter Eisentraut cc: Maxim Boguk , pgsql-bugs@postgresql.org Subject: Re: BUG #6288: Is ALTER ROLE set client_encoding broken in 9.1? In-reply-to: <1321030104.14677.2.camel@vanquo.pezone.net> References: <201111101109.pAAB9Vja074963@wwwmaster.postgresql.org> <7531.1320936943@sss.pgh.pa.us> <20758.1320971432@sss.pgh.pa.us> <1321030104.14677.2.camel@vanquo.pezone.net> Comments: In-reply-to Peter Eisentraut message dated "Fri, 11 Nov 2011 18:48:24 +0200" Date: Fri, 11 Nov 2011 15:34:39 -0500 Message-ID: <10708.1321043679@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.101 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.201 X-Spam-Level: X-Archive-Number: 201111/94 X-Sequence-Number: 31689 Peter Eisentraut 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