Re: SQL/JSON: functions - Mailing list pgsql-hackers

From Andres Freund
Subject Re: SQL/JSON: functions
Date
Msg-id 20190216051239.wvhizo3hg2lwqyzh@alap3.anarazel.de
Whole thread Raw
In response to Re: SQL/JSON: functions  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
Responses Re: SQL/JSON: functions  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Control your disk usage in PG: Introduction to Disk QuotaExtension
Next
From: Andres Freund
Date:
Subject: Re: chained transactions