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: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-23 08:21:59
Message-ID: CA+HiwqFhOswXBiP+edzZ9Z49nVJJA5-ADHqND6+vF9uSiKu-sw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 23, 2022 at 4:48 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Thu, Aug 18, 2022 at 12:46 PM Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> wrote:
> > The desciprion of the v7 patches:
> >
> > 0003 Add EEOP_SUBTRANS executor step
> > v6 + new recursive JIT
> >
> > 0004 Split JsonExpr execution into steps
> > simply rebase of v6 + used LLMBuildSwitch() in EEOP_JSONEXPR
>
> Will need to spend more time looking at these.

0004 adds the following to initJsonItemCoercions():

+ /* When returning JSON types, no need to initialize coercions */
+ /* XXX domain types on json/jsonb */
+ if (returning->typid == JSONBOID || returning->typid == JSONOID)
+ return NULL;

But maybe it's dead code, because 0001 has this:

+ if (jsexpr->returning->typid != JSONOID &&
+ jsexpr->returning->typid != JSONBOID)
+ jsexpr->coercions =
+ initJsonItemCoercions(pstate, jsexpr->returning,
+ exprType(contextItemExpr));

+ /* We need to handle RETURNING int etc. */

Is this a TODO and what does it mean?

+ * "JsonCoercion == NULL" means no cast is available.
+ * "JsonCoercion.expr == NULL" means no coercion is needed.

As said in my previous email, I wonder if these cases are better
handled by adding JSON_COERCION_ERROR and JSON_COERCION_NONE
coercions?

+/* Skip calling ExecEvalJson() on a JsonExpr? */

ExecEvalJsonExpr()

Will look more.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2022-08-23 08:27:40 Re: Pluggable toaster
Previous Message Drouvot, Bertrand 2022-08-23 07:58:03 Re: pg_stat_have_stats() returns true for dropped indexes (or for index creation transaction rolled back)