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: Thomas Munro <thomas.munro@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2023-10-10T23:34:33Z
Lists: pgsql-hackers
On Tue, Oct 10, 2023 at 10:51:10AM -0400, Evan Jones wrote:
> Here is a quick demonstration of this issue, showing that the quoting
> behavior is different between these two. Mac OS X with the "default" locale
> includes quotes because ą includes  0x85 in its UTF-8 encoding:

Ugh.  rowtypes.c has reminded me as well of gistfuncs.c in pageinspect
where included columns are printed in a ROW-like fashion.  And it also
uses isspace() when we check if double quotes are needed or not.  So
the use of the quotes would equally depend on what macos thinks is
a correct space in this case.
--
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.