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-18T01:50:16Z
Lists: pgsql-hackers
On Sat, Jun 17, 2023 at 10:57:05AM -0400, Evan Jones wrote: > However, if we think this change could be a problem, one fix would be to > switch scanner_isspace() to array_isspace(), which returns true for these > *six* ASCII characters. I am happy to submit a patch to do this. The difference between scanner_isspace() and array_isspace() is that the former matches with what scan.l stores as rules for whitespace characters, but the latter works on values. For hstore, we want the latter, with something that works on values. To keep the change locale to hstore, I think that we should just introduce an hstore_isspace() which is a copy of array_isspace. That's a duplication, sure, but I think that we may want to think harder about \v in the flex scanner, and that's just a few extra lines for something that has not changed in 13 years for arrays. That's also easier to think about for stable branches. If you can send a patch, that helps a lot, for sure! Worth noting that the array part has been changed in 2010, with 95cacd1, for the same reason as what you've proposed for hstore. Thread is here, and it does not mention our flex rules, either: https://www.postgresql.org/message-id/8F72262C-5694-4626-A87F-00604FB5E1D6@trumpet.io Perhaps we could consider \v as a whitespace in the flex scanner itself, but I am scared to do that in any stable branch. Perhaps we could consider that for HEAD in 17~? That's a lot to work around an old BSD bug that macOS has inherited, though. -- Michael
Commits
-
CREATE DATABASE: make LOCALE apply to all collation providers.
- a14e75eb0b6a 16.0 cited
-
hstore: Tighten key/value parsing check for whitespaces
- bbfc26d861fa 11.21 landed
- edf1de65e529 12.16 landed
- 78bf0a256d12 13.12 landed
- e0e6829459b0 14.9 landed
- 3a5222a432be 15.4 landed
- d522b05c8c1c 16.0 landed
-
Tighten checks for whitespace in functions that parse identifiers etc.
- 9ae2661fe1fe 10.0 cited