Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLZNu-00074V-Cf for pgsql-bugs@arkaria.postgresql.org; Sun, 14 Mar 2021 22:38:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lLZNs-0007oO-Nf for pgsql-bugs@arkaria.postgresql.org; Sun, 14 Mar 2021 22:38:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLZNs-0007oH-HC for pgsql-bugs@lists.postgresql.org; Sun, 14 Mar 2021 22:38:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLZNp-0007xx-Na for pgsql-bugs@lists.postgresql.org; Sun, 14 Mar 2021 22:38:51 +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 12EMcl6B2932628; Sun, 14 Mar 2021 18:38:47 -0400 From: Tom Lane To: ebakke@ultorg.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16926: initdb fails on Windows when binary path contains certain non-ASCII characters In-reply-to: <16926-e4ef345545d185ab@postgresql.org> References: <16926-e4ef345545d185ab@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 14 Mar 2021 00:43:35 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2932626.1615761527.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 14 Mar 2021 18:38:47 -0400 Message-ID: <2932627.1615761527@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > On PostgreSQL 13.1 on US English Windows 10, "initdb" will fail with the > following error if the initdb.exe executable is located on a path that > contains certain non-ASCII characters, and "--encoding=UTF8" is specified. > In the following example, I am executing initdb.exe from a folder called > "C:\Users\ebakke\ZRoot\PostgresTest\FolderÆØÅ\pgsql\bin": I'm afraid this is largely a case of "Doctor, it hurts when I do this!" ... "So don't do that." Although we could possibly fix initdb to not fail under these circumstances, I think you'd have continuing pain from not being able to represent the installation path in the database encoding. References to, for example, the script files for standard extensions would be impossible to write in SQL. I was curious enough to dig for exactly where initdb has a problem, and I found that it's where it generates a COPY command to populate information_schema.sql_features from .../share/sql_features.txt in the installation file tree. The backend's expecting the COPY to be entirely valid UTF8 text, but the pathname string won't be. I thought of using COPY FROM STDIN, but that doesn't work in a standalone backend, and I doubt we want to expend the effort to make it do so. Or we could have initdb convert the data to a large INSERT...VALUES command. But on the whole, given the likely follow-on issues people would have with this sort of situation, it doesn't seem worth putting effort into fixing just this particular place in initdb. Thinking about bigger-picture solutions, the first idea that comes to mind is that maybe file paths ought to be treated as bytea rather than text, since we have no good reason to expect that they are in any particular encoding. But making that happen would be a research project, and it'd likely result in some unpleasant compatibility breakage. In short, this doesn't seem likely to get improved any time soon. regards, tom lane