Re: [PATCH] hstore: Fix parsing on Mac OS X: isspace() is locale specific

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Evan Jones <evan.jones@datadoghq.com>
Cc: pgsql-hackers@postgresql.org
Date: 2023-06-06T11:37:45Z
Lists: pgsql-hackers
On Mon, Jun 05, 2023 at 11:26:56AM -0400, Evan Jones wrote:
> This patch fixes a rare parsing bug with unicode characters on Mac OS X.
> The problem is that isspace() on Mac OS X changes its behaviour with the
> locale. Use scanner_isspace instead, which only returns true for ASCII
> whitespace. It appears other places in the Postgres code have already run
> into this, since a number of places use scanner_isspace instead. However,
> there are still a lot of other calls to isspace(). I'll try to take a quick
> look to see if there might be other instances of this bug.

Indeed.  It looks like 9ae2661 missed this spot.
--
Michael

Commits

  1. CREATE DATABASE: make LOCALE apply to all collation providers.

  2. hstore: Tighten key/value parsing check for whitespaces

  3. Tighten checks for whitespace in functions that parse identifiers etc.