Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJOPK-004bTV-F3 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2024 02:17:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJOPI-006A7D-6v for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2024 02:17:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJOPH-006A74-LN for pgsql-hackers@lists.postgresql.org; Tue, 18 Jun 2024 02:17:12 +0000 Received: from 009.lax.mailroute.net ([199.89.1.12]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJOPF-001q9C-IH for pgsql-hackers@lists.postgresql.org; Tue, 18 Jun 2024 02:17:11 +0000 Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4W39PJ5DprzlgMVR; Tue, 18 Jun 2024 02:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:subject:subject:received:received; s=mr01; t= 1718677027; x=1721269028; bh=Q7m5wlKjvXY8eRPnPFOAYv6M7orOd7f2Ptg t4OTnQfM=; b=GUT9M+8YFPYAEMKpUbw6anXM6F0kmcfmSgC7qDYCJcTOy8y+zjX WmJsjOD4nCdsZQxmEbokp2gUe3vV95p52IkDx5s56tXFGm27Z3IXrmztjS0DtYvM MWp6oc4LrIYAB0Tkivop6sjExAq/JVfcOPjA+37Hx+KGEG236y+7HSET090c1VFP bqnQZJd6NFwD9g9dddUHRE+TOra6YLqmlC4EchQ7eN/lxJKWfYwM5vUDf9DsOYll BNW7DVYqmf0KZxw4xXia8+AC7HMuPQFoT4ZAXI1DaehY/0ptKVgeSY7eehoI2MbB No0Cl1JKYYmWNmxaLD+045ID0WMFnSeZGCw== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 8vU1T6Bgxp0E; Tue, 18 Jun 2024 02:17:07 +0000 (UTC) Received: from [73.103.120.3] (c-73-103-120-3.hsd1.in.comcast.net [73.103.120.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jcflack@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4W39PH434dzlgMVQ; Tue, 18 Jun 2024 02:17:07 +0000 (UTC) Subject: Re: jsonpath: Missing regex_like && starts with Errors? To: "David E. Wheeler" References: <9272D3A9-8805-4DE1-A95F-84EB210EC121@justatheory.com> <666CFC8E.1000108@acm.org> <666DBFEC.70201@acm.org> <9BAFB50F-267E-4078-9558-36155E93A723@justatheory.com> <6670BC59.1010204@acm.org> <565BA19A-EC85-4DE0-A21B-A298C358096E@justatheory.com> Cc: PostgreSQL Hackers From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <6670EE22.60808@acm.org> Date: Mon, 17 Jun 2024 22:17:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <565BA19A-EC85-4DE0-A21B-A298C358096E@justatheory.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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