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 1ppEgg-0002Pe-12 for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Apr 2023 20:45:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ppEgd-0001IL-UZ for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Apr 2023 20:45:55 +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 1ppEgd-0001IC-M2 for pgsql-bugs@lists.postgresql.org; Wed, 19 Apr 2023 20:45:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ppEga-000kmN-KJ for pgsql-bugs@lists.postgresql.org; Wed, 19 Apr 2023 20:45:54 +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 33JKjmhu3017543; Wed, 19 Apr 2023 16:45:48 -0400 From: Tom Lane To: Jeff Davis cc: Richard Guo , PostgreSQL mailing lists Subject: Re: Assert failure with ICU support In-reply-to: References: Comments: In-reply-to Jeff Davis message dated "Wed, 19 Apr 2023 13:31:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3017541.1681937148.1@sss.pgh.pa.us> Date: Wed, 19 Apr 2023 16:45:48 -0400 Message-ID: <3017542.1681937148@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > We should probably just check that it's plain ASCII. That was about the same conclusion I came to. More or less c = *v->now++; - if (!iscalnum(c)) + if (!isascii(c) || !iscalnum(c)) RETV(PLAIN, c); although I'm not sure if it's a good idea to apply isascii() to something that's wider than char. It might be advisable, if ugly, to write + if (c >= 0x100 || !iscalnum(c)) I'm also inclined to remove that "assert(iscalpha(c))" in the switch. That's not checking sanity of our own code, just consistency of the functions; and as this episode shows it's more trouble than it's worth. regards, tom lane