pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chapman Flack <jcflack@acm.org>
To: David E. Wheeler <david@justatheory.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: jsonpath: Missing regex_like && starts with Errors?
Date: Mon, 17 Jun 2024 22:17:06 -0400
Message-ID: <6670EE22.60808@acm.org> (raw)
In-Reply-To: <565BA19A-EC85-4DE0-A21B-A298C358096E@justatheory.com>
References: <9272D3A9-8805-4DE1-A95F-84EB210EC121@justatheory.com>
	<666CFC8E.1000108@acm.org>
	<DE3701E1-E45E-489B-AFE8-68E1379EEAD3@justatheory.com>
	<666DBFEC.70201@acm.org>
	<F789151A-85EF-4D72-81CB-49E5472B3A78@justatheory.com>
	<9BAFB50F-267E-4078-9558-36155E93A723@justatheory.com>
	<6670BC59.1010204@acm.org>
	<565BA19A-EC85-4DE0-A21B-A298C358096E@justatheory.com>

On 06/17/24 19:17, David E. Wheeler wrote:
> [1]: https://github.com/postgres/postgres/blob/82ed67a/src/backend/utils/adt/jsonpath_exec.c#L2058-L2059

Huh, I just saw something peculiar, skimming through the code:

https://github.com/postgres/postgres/blob/82ed67a/src/backend/utils/adt/jsonpath_exec.c#L1385

We allow .boolean() applied to a jbvBool, a jbvString (those are the only
two possibilities allowed by the standard), or to a jbvNumeric (!), but
only if it can be serialized and then parsed as an int4, otherwise we say
ERRCODE_NON_NUMERIC_SQL_JSON_ITEM, or if it survived all that we call it
true if it isn't zero.

I wonder what that alternative is doing there.

It also looks like the expected errcode (in the standard, if the item
was not boolean or string) would be 2202V "non-boolean SQL/JSON item" ...
which isn't in our errcodes.txt.

Regards,
-Chap





view thread (12+ messages)  latest in thread

Message-ID: <6670EE22.60808@acm.org>
Permalink:  ../6670EE22.60808@acm.org/
Also on:    postgresql.org/message-id/6670EE22.60808@acm.org

 · 

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: jcflack@acm.org, david@justatheory.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: jsonpath: Missing regex_like && starts with Errors?
  In-Reply-To: <6670EE22.60808@acm.org>

* 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