Re: JSON constructors and window functions - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: JSON constructors and window functions
Date
Msg-id 853f43a3-e4ac-9e59-2c0c-6008b8035f67@dunslane.net
Whole thread Raw
In response to JSON constructors and window functions  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Responses Re: JSON constructors and window functions  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On 4/3/22 20:11, Andres Freund wrote:
> Hi,
>
> On 2022-04-03 18:56:39 -0400, Andrew Dunstan wrote:
>> 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);
> The hash was created in a context that's already freed.
>
[...]
>
>
> I don't think you're allowed to free stuff in a finalfunc - we might reuse the
> transition state for further calls to the aggregate.
>


Doh! Of course! I'll fix it in the morning. Thanks.


cheers


andrew


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




pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Next
From: Amit Kapila
Date:
Subject: Re: Skipping logical replication transactions on subscriber side