Re: SQL/JSON features for v15
Nikita Glukhov <n.gluhov@postgrespro.ru>
From: Nikita Glukhov <n.gluhov@postgrespro.ru>
To: Pavel Stehule <pavel.stehule@gmail.com>,
Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>,
"Jonathan S. Katz" <jkatz@postgresql.org>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andrew Dunstan <andrew@dunslane.net>, Tom Lane <tgl@sss.pgh.pa.us>,
Michael Paquier <michael@paquier.xyz>,
John Naylor <john.naylor@enterprisedb.com>,
Amit Langote <amitlangote09@gmail.com>
Date: 2022-08-23T18:16:24Z
Lists: pgsql-hackers
On 23.08.2022 20:38, Pavel Stehule wrote:
> út 23. 8. 2022 v 19:27 odesílatel Andres Freund <andres@anarazel.de>
> napsal:
>
> Hi,
>
> On 2022-08-23 18:06:22 +0200, Pavel Stehule wrote:
> > The errors that should be handled are related to json structure
> errors. I
> > don't think so we have to handle all errors and all conversions.
> >
> > The JSON knows only three types - and these conversions can be
> written
> > specially for this case - or we can write json io routines to be
> able to
> > signal error
> > without an exception.
>
> I think that's not true unfortunately. You can specify return
> types, and
> composite types can be populated. Which essentially requires arbitrary
> coercions.
>
>
> Please, can you send an example? Maybe we try to fix a feature that is
> not required by standard.
- Returning arbitrary types in JSON_VALUE using I/O coercion
from JSON string (more precisely, text::arbitrary_type cast):
SELECT JSON_QUERY(jsonb '"1, 2"', '$' RETURNING point);
json_query
------------
(1,2)
(1 row)
- Returning composite and array types in JSON_QUERY, which is implemented
reusing the code of our json[b]_populate_record[set]():
SELECT JSON_QUERY(jsonb '[1, "2", null]', '$' RETURNING int[]);
json_query
------------
{1,2,NULL}
(1 row)
--
Nikita Glukhov
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company
Commits
-
JSON_TABLE: Add support for NESTED paths and columns
- bb766cde63b4 17.0 landed
-
Add basic JSON_TABLE() functionality
- de3600452b61 17.0 landed
-
Add SQL/JSON query functions
- 6185c9737cf4 17.0 landed
-
Add soft error handling to some expression nodes
- aaaf9449ec6b 17.0 landed
-
Adjust populate_record_field() to handle errors softly
- 1edb3b491bee 17.0 landed
-
Refactor code used by jsonpath executor to fetch variables
- faa2b953ba3b 17.0 landed
-
Add more SQL/JSON constructor functions
- 03734a7fed7d 17.0 landed
-
SQL/JSON: support the IS JSON predicate
- 6ee30209a6f1 16.0 landed
-
SQL/JSON: add standard JSON constructor functions
- 7081ac46ace8 16.0 landed
-
Revert SQL/JSON features
- 96ef3237bf74 15.0 landed
- 2f2b18bd3f55 16.0 landed
-
Numeric error suppression in jsonpath
- 16d489b0fe05 12.0 cited