Re: Bug in jsonb_in function (14 & 15 version are affected)

From: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in jsonb_in function (14 & 15 version are affected)
Date: 2023-03-16 05:18:01
Message-ID: 23d202968dfbc84468cc9cf384819fc31eb10788.camel@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

В Пн, 13/03/2023 в 13:58 -0400, Tom Lane пишет:
> Nikolay Shaplov <dhyan(at)nataraj(dot)su> writes:
> > I found a bug in jsonb_in function (it converts json from sting representation
> >  into jsonb internal representation).
>
> Yeah.  Looks like json_lex_string is failing to honor the invariant
> that it needs to set token_terminator ... although the documentation
> of the function certainly isn't helping.  I think we need the attached.
>
> A nice side benefit is that the error context reports get a lot more
> useful --- somebody should have inquired before as to why they were
> so bogus.
>
>                         regards, tom lane
>

Good day, Tom and all.

Merged patch looks like start of refactoring.

Colleague (Nikita Glukhov) propose further refactoring of jsonapi.c:
- use of inline functions instead of macroses,
- more uniform their usage in token success or error reporting,
- simplify json_lex_number and its usage a bit.
Also he added tests for fixed bug.

-----

Regards,
Yura Sokolov.

Attachment Content-Type Size
0001-Refactor-JSON-lexer-error-reporting.patch text/x-patch 19.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-03-16 05:20:10 Re: Add macros for ReorderBufferTXN toptxn
Previous Message Bharath Rupireddy 2023-03-16 05:10:05 Re: Add macros for ReorderBufferTXN toptxn