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 1n4QIH-0004Sf-8f for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jan 2022 16:34:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n4QIF-0003JV-MM for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jan 2022 16:34:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4QIF-0003JL-Bk for pgsql-hackers@lists.postgresql.org; Mon, 03 Jan 2022 16:34:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4QIC-0004zQ-I7 for pgsql-hackers@lists.postgresql.org; Mon, 03 Jan 2022 16:34:41 +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 203GYax13563191; Mon, 3 Jan 2022 11:34:36 -0500 From: Tom Lane To: Dag Lem cc: Thomas Munro , Andres Freund , PostgreSQL Hackers Subject: Re: daitch_mokotoff module In-reply-to: References: <0cac2d60-5b85-59c6-1ac1-77092b8688b7@enterprisedb.com> <20220102213150.y2tpuwqhruu5t2y5@alap3.anarazel.de> <3461033.1641177713@sss.pgh.pa.us> Comments: In-reply-to Dag Lem message dated "Mon, 03 Jan 2022 14:07:09 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3563189.1641227676.1@sss.pgh.pa.us> Date: Mon, 03 Jan 2022 11:34:36 -0500 Message-ID: <3563190.1641227676@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dag Lem writes: > Tom Lane writes: >> (We do have methods for dealing with non-ASCII test cases, but >> I can't see that this patch is using any of them.) > I naively assumed that tests would be run in an UTF8 environment. Nope, not necessarily. Our current best practice for this is to separate out encoding-dependent test cases into their own test script, and guard the script with an initial test on database encoding. You can see an example in src/test/modules/test_regex/sql/test_regex_utf8.sql and the two associated expected-files. It's a good idea to also cover as much as you can with pure-ASCII test cases that will run regardless of the prevailing encoding. > Running "ack -l '[\x80-\xff]'" in the contrib/ directory reveals that > two other modules are using UTF8 characters in tests - citext and > unaccent. Yeah, neither of those have been upgraded to said best practice. (If you feel like doing the legwork to improve that situation, that'd be great.) > Looking into the unaccent module, I don't quite understand how it will > work with various encodings, since it doesn't seem to decode its input - > will it fail if run under anything but ASCII or UTF8? Its Makefile seems to be forcing the test database to use UTF8. I think this is a less-than-best-practice choice, because then we have zero test coverage for other encodings; but it does prevent test failures. regards, tom lane