Hi,

On 2018-12-05 02:01:19 +0300, Nikita Glukhov wrote:

> +     if (!PG_ARGISNULL(1) &&
> +             strncmp("any", VARDATA(type), VARSIZE_ANY_EXHDR(type)))
> +     {
> +             JsonLexContext *lex;
> +             JsonTokenType tok;
> +
> +             lex = makeJsonLexContext(json, false);
> +
> +             /* Lex exactly one token from the input and check its type. */
> +             PG_TRY();
> +             {
> +                     json_lex(lex);
> +             }
> +             PG_CATCH();
> +             {
> +                     if (ERRCODE_TO_CATEGORY(geterrcode()) == 
> ERRCODE_DATA_EXCEPTION)
> +                     {
> +                             FlushErrorState();
> +                             MemoryContextSwitchTo(mcxt);
> +                             PG_RETURN_BOOL(false);  /* invalid json */
> +                     }
> +                     PG_RE_THROW();
> +             }
> +             PG_END_TRY();


It baffles me that a year after I raised this as a serious issue, in
this thread, this patch still contains code like this.


Greetings,

Andres Freund

Reply via email to