Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 898771337B2F for ; Fri, 21 Jan 2011 18:17:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 80459-09 for ; Fri, 21 Jan 2011 22:17:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 065431337990 for ; Fri, 21 Jan 2011 18:17:01 -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 p0LMH0Hx000748; Fri, 21 Jan 2011 17:17:00 -0500 (EST) To: Adrian Klaver cc: Kim Mortensen , Hiroshi Saito , pgsql-odbc@postgresql.org Subject: Re: problem connecting via ODBC when unicode (now in correct forum.). In-reply-to: <4D39F6F8.3080700@gmail.com> References: <201101210806.06568.adrian.klaver@gmail.com> <201101210833.49544.adrian.klaver@gmail.com> <4D39CD82.6070101@winpg.jp> <4D39EC6A.6060304@gmail.com> <4D39F6F8.3080700@gmail.com> Comments: In-reply-to Adrian Klaver message dated "Fri, 21 Jan 2011 13:13:28 -0800" Date: Fri, 21 Jan 2011 17:17:00 -0500 Message-ID: <747.1295648220@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201101/18 X-Sequence-Number: 10565 Adrian Klaver writes: > I believe the problem, as Hiroshi Saito pointed out, is that the client > encoding is being set on Windows before the connection is attempted and > that it is picking the wrong one. Per his post pgAdmin and JDBC are > probably just starting with UTF8 and that is why they succeed. At this > point I don't know how to get around that. AFAIK the only way to get the mentioned error message (about "no pg_hba.conf entry") from this kind of problem is if the DBA is listing user names directly in pg_hba.conf. Since there is no encoding conversion active this early in backend startup, non-ASCII user names can only work if the encoding used in pg_hba.conf matches what is arriving from the client. Possible solution: make *two* (or more) entries in pg_hba.conf, one in each encoding that clients might be using. This is probably unmaintainable though, particularly when using Windows editors which are almost certainly going to think they know more than you do about encodings. Better idea: refrain from mentioning specific usernames in pg_hba.conf. Usually, anything you might want to do that way can be done better in other ways. For instance, make use of the CONNECT privilege if you're running a release new enough to have it. By and large, though, non-ASCII user names are going to be problematic anyway --- even if you got past the pg_hba.conf check, I think you might just get a "no such user" failure when the client sends the name in an encoding that doesn't match what's in the system catalog. This is an area that's known to need work. regards, tom lane