Thread: JSON parser discards value of string token

JSON parser discards value of string token

From
Antonin Houska
Date:
Although the following problem does not seem to be exposed in the core, I
think it's still a problem to fix. (I've hit it when implementing a custom
parser for extension configuration file.)

If makeJsonLexContextCstringLen() is passed need_escapes=false,
JsonLexContext.strval is not initialized, and in turn, functions of
JsonSemAction which should receive the string token value
(e.g. object_field_start) receive NULL.

Attached is a patch that fixes the problem. If this approach is acceptable,
then it'd probably be worth to also rename the JsonLexContext.strval field to
something that recalls the "de-escaping", e.g. "noesc"?

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com


Attachment