Re: remaining sql/json patches

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: remaining sql/json patches
Date: 2023-09-18 03:15:40
Message-ID: CA+HiwqGq=v9HbgbMt2mHuxwhFq8u0dxqO9-aMtb0g9XamdWGLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 17, 2023 at 3:34 PM Erik Rijkers <er(at)xs4all(dot)nl> wrote:
> Op 9/14/23 om 10:14 schreef Amit Langote:
> >
> >
>
> Hi Amit,
>
> Just now I built a v14-patched server and I found this crash:
>
> select json_query(jsonb '
> {
> "arr": [
> {"arr": [2,3]}
> , {"arr": [4,5]}
> ]
> }'
> , '$.arr[*].arr ? (@ <= 3)' returning anyarray WITH WRAPPER) --crash
> ;
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> connection to server was lost

Thanks for the report.

Attached updated version fixes the crash, but you get an error as is
to be expected:

select json_query(jsonb '
{
"arr": [
{"arr": [2,3]}
, {"arr": [4,5]}
]
}'
, '$.arr[*].arr ? (@ <= 3)' returning anyarray WITH WRAPPER);
ERROR: cannot accept a value of type anyarray

unlike when using int[]:

select json_query(jsonb '
{
"arr": [
{"arr": [2,3]}
, {"arr": [4,5]}
]
}'
, '$.arr[*].arr ? (@ <= 3)' returning int[] WITH WRAPPER);
json_query
------------
{2,3}
(1 row)

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v15-0005-Claim-SQL-standard-compliance-for-SQL-JSON-featu.patch application/octet-stream 2.3 KB
v15-0002-Add-soft-error-handling-to-populate_record_field.patch application/octet-stream 37.6 KB
v15-0001-Support-for-soft-error-handling-during-CoerceVia.patch application/octet-stream 14.0 KB
v15-0004-JSON_TABLE.patch application/octet-stream 170.8 KB
v15-0003-SQL-JSON-query-functions.patch application/octet-stream 203.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-09-18 03:43:25 Re: Add 'worker_type' to pg_stat_subscription
Previous Message jian he 2023-09-18 03:11:02 Re: SQL:2011 application time