pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nikita Glukhov <n.gluhov@postgrespro.ru>
To: Jonathan S. Katz <jkatz@postgresql.org>
To: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: John Naylor <john.naylor@enterprisedb.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Subject: Re: SQL/JSON features for v15
Date: Wed, 24 Aug 2022 00:29:00 +0300
Message-ID: <3596205e-ce1e-6959-7559-6ddd67f8294b@postgrespro.ru> (raw)
In-Reply-To: <ab10b5df-fcc2-5871-7027-e7f73b11559d@postgresql.org>
References: <abd9b83b-aa66-f230-3d6d-734817f0995d@postgresql.org>
	<20220815223853.itrlpqgpqheg6r6a@awork3.anarazel.de>
	<225d341b-f310-eed0-ceff-b8ec61669d9f@postgrespro.ru>
	<20220816021425.5sa6gx67zmpou3bc@awork3.anarazel.de>
	<8d0ffc54-469a-ffab-68a3-8b547e24a08d@postgresql.org>
	<7d83684b-7932-9f29-400b-0beedfafcdd4@postgrespro.ru>
	<69022273-e7e3-6d1a-10f8-d1b4740e4b97@postgresql.org>
	<92cab50c-152b-84fc-fd49-12b936113a3d@postgresql.org>
	<CA+TgmoaAZq6rRdVA65PBXBKs=jUHhf42Jf78kBLOaX3c6J7MfQ@mail.gmail.com>
	<692364.1661267311@sss.pgh.pa.us>
	<35468585-e18f-3be6-a228-4ec478f796ac@postgresql.org>
	<716936.1661275451@sss.pgh.pa.us>
	<f1c79751-2916-a9cf-c8b9-668b9700edb8@dunslane.net>
	<ab10b5df-fcc2-5871-7027-e7f73b11559d@postgresql.org>


On 23.08.2022 22:31, Jonathan S. Katz wrote:
> On 8/23/22 2:10 PM, Andrew Dunstan wrote:
>>
>> On 2022-08-23 Tu 13:24, Tom Lane wrote:
>>> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
>>>> I saw Andrew suggest that the controversial parts of the patchset 
>>>> may be
>>>> severable from some of the new functionality, so I would like to see
>>>> that proposal and if it is enough to overcome concerns.
>>> It's an interesting suggestion.  Do people have the cycles available
>>> to make it happen in the next few days?
>>>
>> I will make time although probably Nikita and/or Amit would be quicker
>> than I would be.
>
> If you all can, you have my +1 to try it and see what folks think.

I am ready to start hacking now, but it's already night in Moscow, so
any result will be only tomorrow.

Here is my plan:

0. Take my last v7-0001 patch as a base.  It already contains refactoring
of JsonCoercion code.  (Fix 0002 is not needed anymore, because it is for
json[b] domains, which simply will not be supported.)

1. Replace JSON_COERCION_VIA_EXPR in JsonCoercion with new
JsonCoercionType(s) for hardcoded coercions.

2. Disable all non-JSON-compatible output types in coerceJsonFuncExpr().

3. Add missing safe type input functions for integers, numerics, and
maybe others.

4. Implement hardcoded coercions using these functions in
ExecEvalJsonExprCoercion().

5. Try to allow only constants (and also maybe column/parameter
references) in JSON_VALUE's DEFAULT expressions.  This should be enough
for the most of practical cases.  JSON_QUERY even does not have DEFAULT
expressions -- it has only EMPTY ARRAY and EMPTY OBJECT, which can be
treated as simple JSON constants.

But it is possible to allow all other expressions in ERROR ON ERROR
case, and I don't know if it will be consistent enough to allow some
expressions in one case and deny in other.

And there is another problem: expressions can be only checked for
Const-ness only after expression simplification.  AFAIU, at the
parsing stage they look like 'string'::type.  So, it's unclear if it
is correct to check expressions in ExecInitExpr().

6. Remove subtransactions.

-- 
Nikita Glukhov
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company

view thread (95+ messages)  latest in thread

Message-ID: <3596205e-ce1e-6959-7559-6ddd67f8294b@postgrespro.ru>
Permalink:  ../3596205e-ce1e-6959-7559-6ddd67f8294b@postgrespro.ru/
Also on:    postgresql.org/message-id/3596205e-ce1e-6959-7559-6ddd67f8294b@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: n.gluhov@postgrespro.ru, jkatz@postgresql.org, andrew@dunslane.net, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org, michael@paquier.xyz, john.naylor@enterprisedb.com, amitlangote09@gmail.com
  Subject: Re: SQL/JSON features for v15
  In-Reply-To: <3596205e-ce1e-6959-7559-6ddd67f8294b@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox