Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPeTD-0007R7-FX for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2019 02:44:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hPeTC-0007Hy-2O for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2019 02:44:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPeTB-0007Fs-PQ for pgsql-hackers@lists.postgresql.org; Sun, 12 May 2019 02:44:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPeT9-00047X-1V for pgsql-hackers@postgresql.org; Sun, 12 May 2019 02:44:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4C2hx0w025384; Sat, 11 May 2019 22:43:59 -0400 From: Tom Lane To: Noah Misch cc: Andrew Dunstan , PostgreSQL Hackers Subject: Re: Augment every test postgresql.conf In-reply-to: <20190512015615.GD1124997@rfd.leadboat.com> References: <20181229021950.GA3302966@rfd.leadboat.com> <20181230024014.GA181668@gust.leadboat.com> <16623.1546141591@sss.pgh.pa.us> <20181230055346.GB156585@gust.leadboat.com> <20190407064156.GC1914190@rfd.leadboat.com> <20190512015615.GD1124997@rfd.leadboat.com> Comments: In-reply-to Noah Misch message dated "Sat, 11 May 2019 18:56:15 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25382.1557629039.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 11 May 2019 22:43:59 -0400 Message-ID: <25383.1557629039@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Noah Misch writes: > Pushed. This broke 010_dump_connstr.pl on bowerbird, introducing 'inval= id > byte sequence for encoding "UTF8"' errors. That's because log_connectio= ns > renders this 010_dump_connstr.pl solution insufficient: Ugh. > 4. If GetMessageEncoding()=3D=3DPG_SQL_ASCII, make pgwin32_message_to_UT= F16() > return NULL. The caller will always send untranslated bytes to write= () or > ReportEventA(). This seems consistent with the SQL_ASCII concept and= with > pg_do_encoding_conversion()'s interpretation of SQL_ASCII. > 5. When including a datname or rolname value in a message, hex-escape > non-ASCII bytes. They are byte sequences, not text of known encoding= . > This preserves the most information, but it's overkill and ugly in th= e > probably-common case of one encoding across all databases of a cluste= r. > I'm inclined to do (1) in back branches and (4) in HEAD only. (If start= ing > fresh today, I would store the encoding of each rolname and dbname or ju= st use > UTF8 for those particular fields.) Other preferences? I agree that (4) is a fairly reasonable thing to do, and wouldn't mind back-patching that. Taking a wider view, this seems closely related to something I've been thinking about in connection with the recent pg_stat_activity contretemps: that mechanism is also shoving strings across database boundaries without a lot of worry about encodings. Maybe we should try to develop a common solution. One difference from the datname/rolname situation is that for pg_stat_activity we can know the source encoding --- we aren't storing it now, but we easily could. If we're thinking of a future solution only, adding a "name encoding" field to relevant shared catalogs makes sense perhaps. Alternatively, requiring names in shared catalogs to be UTF8 might be a reasonable answer too. In all these cases, throwing an error when we can't translate a character into the destination encoding is not very pleasant. For pg_stat_activity, I was imagining that translating such characters to '?' might be the best answer. I don't know if we can get away with that for the datname/rolname case --- at the very least, it opens problems with apparent duplication of names that should be unique. I don't much like your hex-encoding answer, though; that has its own uniqueness-violation hazards, plus it's ugly. I don't have a strong feeling about what's best. regards, tom lane