Re: JSON constructors and window functions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Cc: n(dot)gluhov(at)postgrespro(dot)ru
Subject: Re: JSON constructors and window functions
Date: 2022-04-03 22:56:39
Message-ID: 16faf0bc-79d7-709f-6eed-42b1ce1d7389@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 4/2/22 15:40, Andrew Dunstan wrote:
> On 4/2/22 01:25, Jaime Casanova wrote:
>> I got a crash running the below query on the regression database:
>>
>> """
>> select pg_catalog.json_object_agg_unique(10,
>> cast(ref_0.level2_no as int4))
>> over (partition by ref_0.parent_no
>> order by ref_0.level2_no)
>> from public.transition_table_level2 as ref_0;
>> """
>>
>> Attached the backtrace.
>>
>> PS: I'm cc'ing Andrew and Nikita because my feeling is that this is
>> f4fb45d15c59d7add2e1b81a9d477d0119a9691a responsability.
>
>
> Hmm. Thanks for the report. The code in json_unique_check_key() looks
> sane enough., so the issue is probably elsewhere. I'll keep digging.

Haven't found the issue yet :-( It happens on the second call for the
partition to  json_check_unique_key().

Here's a more idiomatic and self-contained query that triggers the problem.

select json_objectagg('10' : ref_0.level2 with unique keys)
    over (partition by ref_0.parent_no order by ref_0.level2)
from (values (1::int,1::int),(1,2),(2,1),(2,2)) as ref_0(parent_no,level2);

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-04-03 23:01:30 Re: A qsort template
Previous Message Joseph Koshakow 2022-04-03 22:19:54 Re: Fix overflow in DecodeInterval