Re: SQL/JSON features for v15

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Subject: Re: SQL/JSON features for v15
Date: 2022-08-29 12:56:40
Message-ID: CA+HiwqHjr0UE2=OR14DWE=ykrjvLyZMvX8xFDt-GDvWm3AuMzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 27, 2022 at 5:11 AM Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> wrote:
> On 26.08.2022 22:25, Andrew Dunstan wrote:
>
> On 2022-08-24 We 20:05, Nikita Glukhov wrote:
>
> v8 - is a highly WIP patch, which I failed to finish today.
> Even some test cases fail now, and they simply show unfinished
> things like casts to bytea (they can be simply removed) and missing
> safe input functions.
>
> Thanks for your work, please keep going.
>
> I have completed in v9 all the things I previously planned:
>
> - Added missing safe I/O and type conversion functions for
> datetime, float4, varchar, bpchar. This introduces a lot
> of boilerplate code for returning errors and also maybe
> adds some overhead.

Didn't know that we have done similar things in the past for jsonpath, as in:

commit 16d489b0fe058e527619f5e9d92fd7ca3c6c2994
Author: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
Date: Sat Mar 16 12:21:19 2019 +0300

Numeric error suppression in jsonpath

BTW, maybe the following hunk in boolin_opt_error() is unnecessary?

- len = strlen(str);
+ len -= str - in_str;

> - Added JSON_QUERY coercion to UTF8 bytea using pg_convert_to().
>
> - Added immutability checks that were missed with elimination
> of coercion expressions.
> Coercions text::datetime, datetime1::datetime2 and even
> datetime::text for some datetime types are mutable.
> datetime::text can be made immutable by passing ISO date
> style into output functions (like in jsonpath).
>
> - Disabled non-Const expressions in DEFAULT ON EMPTY in non
> ERROR ON ERROR case. Non-constant expressions are tried to
> evaluate into Const directly inside transformExpr().

I am not sure if it's OK to eval_const_expressions() on a Query
sub-expression during parse-analysis. IIUC, it is only correct to
apply it to after the rewriting phase.

> Maybe it would be better to simply remove DEFAULT ON EMPTY.

So +1 to this for now.

> It is possible to easily split this patch into several subpatches,
> I will do it if needed.

That would be nice indeed.

I'm wondering if you're going to change the PASSING values
initialization to add the steps into the parent JsonExpr's ExprState,
like the previous patch was doing?

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2022-08-29 13:02:38 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Previous Message Ranier Vilela 2022-08-29 12:51:28 Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)