Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vrdlh-00Fifw-04 for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Feb 2026 15:10:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrdlf-001kP3-2Y for pgsql-bugs@arkaria.postgresql.org; Sun, 15 Feb 2026 15:10:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vrdlf-001kOm-1i for pgsql-bugs@lists.postgresql.org; Sun, 15 Feb 2026 15:10:39 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vrdlc-00000000kcb-0a3h for pgsql-bugs@lists.postgresql.org; Sun, 15 Feb 2026 15:10:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 61FFAXhf911029; Sun, 15 Feb 2026 10:10:33 -0500 From: Tom Lane To: "David G. Johnston" cc: "615695028@qq.com" <615695028@qq.com>, "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #19410: Cannot ser client_encoding In-reply-to: References: <19410-ae5020230ee6369b@postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Sun, 15 Feb 2026 07:55:27 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <911027.1771168233.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 15 Feb 2026 10:10:33 -0500 Message-ID: <911028.1771168233@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Saturday, February 14, 2026, PG Bug reporting form < > noreply@postgresql.org> wrote: >> [ SET doesn't persist across sessions ] > Everything you=E2=80=99ve shown worked as expected. Indeed. I suggest reading https://www.postgresql.org/docs/current/config-setting.html which not only explains that the effects of SET are per-session, but lists all the other ways to adjust a server setting. > If you want to always use UTF-8 I=E2=80=99d suggest you figure out how t= o configure > your client to do so. psql will then just auto-detect whatever is actua= lly > in use. It doesn=E2=80=99t really make sense to use SET with client_enc= oding. Yeah, that's an orthogonal issue: you really need client_encoding to match whatever your terminal window is using, or non-ASCII characters won't display correctly. So letting psql deduce it from environment is usually the right thing. regards, tom lane