Re: More new SQL/JSON item methods

Vik Fearing <vik@postgresfriends.org>

From: Vik Fearing <vik@postgresfriends.org>
To: Chapman Flack <chap@anastigmatix.net>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Jeevan Chalke <jeevan.chalke@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-09-01T00:50:43Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Rationalize and improve error messages for some jsonpath items

  2. Clean up a bug in sql/json items commit 66ea94e8e6

  3. Implement various jsonpath methods

  4. Reorganise jsonpath operators and methods

  5. Add numeric_int8_opt_error() to optionally suppress errors

On 8/30/23 19:20, Chapman Flack wrote:
> On 2023-08-30 12:28, Alvaro Herrera wrote:
>>         b) Otherwise, the result of JAE is the SQL/JSON sequence V_1,
>>            ..., V_n.
> 
> This has my Spidey sense tingling, as it seems very parallel to SQL/XML
> where the result of XMLQUERY is to have type XML(SEQUENCE), which is a
> type we do not have, and I'm not sure we have a type for "JSON sequence"
> either, unless SQL/JSON makes it equivalent to a JSON array (which
> I guess is conceivable, more easily than with XML). What does SQL/JSON
> say about this SQL/JSON sequence type and how it should behave?

The SQL/JSON data model comprises SQL/JSON items and SQL/JSON sequences. 
The components of the SQL/JSON data model are:

   — An SQL/JSON item is defined recursively as any of the following:
     • An SQL/JSON scalar, defined as a non-null value of any of the
       following predefined (SQL) types: character string with character
       set Unicode, numeric, Boolean, or datetime.
     • An SQL/JSON null, defined as a value that is distinct from any
       value of any SQL type. NOTE 109 — An SQL/JSON null is distinct
       from the SQL null value.
     • An SQL/JSON array, defined as an ordered list of zero or more
       SQL/JSON items, called the SQL/JSON elements of the SQL/JSON
       array.
     • An SQL/JSON object, defined as an unordered collection of zero or
       more SQL/JSON members, where an SQL/JSON member is a pair whose
       first value is a character string with character set Unicode and
       whose second value is an SQL/JSON item. The first value of an
       SQL/JSON member is called the key and the second value is called
       the bound value.

   — An SQL/JSON sequence is an ordered list of zero or more SQL/JSON
     items.

-- 
Vik Fearing