Subject: Re: SQL/JSON revisited

From: Erik Rijkers <[email-masked]>
Date: Mon, 20 Feb 2023 15:41:36 +0100

Op 20-02-2023 om 08:35 schreef Amit Langote:
>>
> 
> Rebased again over queryjumble overhaul.
>

Hi,

But the following statement is a problem. It does not crash but it goes 
off, half-freezing the machine, and only comes back after fanatic 
Ctrl-C'ing.

select json_query(jsonb '[3,4]', '$[*]' returning bigint[] empty object 
on error);

Can you have a look?

Thanks,

Erik Rijkers

PS
Log doesn't really have anything interesting:

2023-02-20 14:57:06.073 CET 1336 LOG:  server process (PID 1493) was 
terminated by signal 9: Killed
2023-02-20 14:57:06.073 CET 1336 DETAIL:  Failed process was running: 
select json_query(jsonb '[3,4]', '$[*]' returning bigint[] empty object 
on error);
2023-02-20 14:57:06.359 CET 1336 LOG:  terminating any other active 
server processes
2023-02-20 14:57:06.667 CET 1336 LOG:  all server processes terminated; 
reinitializing
2023-02-20 14:57:11.870 CET 1556 LOG:  database system was interrupted; 
last known up at 2023-02-20 14:44:43 CET

---

From: Amit Langote <[email-masked]>
Date: Tue, 21 Feb 2023 12:09:15 +0900

> select json_query(jsonb '[3,4]', '$[*]' returning bigint[] empty object

Thanks for the test case.  It caused ExecInterpExpr() to enter an
infinite loop, which I've fixed in the attached updated version.  I've
also merged Elena's documentation changes; I can see that
<replaceable> is more correct.

Now looking at Andres' comments, though, posting a version containing
a fix for the above case so Erik may continue the testing in the
meantime.

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

---

From: Amit Langote <[email-masked]>
Date: Tue, 21 Feb 2023 14:40:09 +0900

> <replaceable> is more correct.

Oops, I hadn't actually done the latter.  Will do when posting the next version.