public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alexander Lakhin <[email protected]>
To: Tom Lane <[email protected]>
To: Chao Li <[email protected]>
Cc: jian he <[email protected]>
Cc: [email protected]
Subject: Re: Making jsonb_agg() faster
Date: Sat, 13 Dec 2025 13:00:00 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CACJufxHuE-P0s1PxiRja26ZMjKUZiCAgWa1jedswo94SFzjXMg@mail.gmail.com>
	<[email protected]>
	<CACJufxGHLYtvOAB7uA59C9Lz+rDPta5Egiii-B5opsZbw6eDDQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Hello Tom,

07.12.2025 18:58, Tom Lane wrote:
>> That’s even better than resolving my comment.
> Cool, done like that then.

I and SQLsmith have discovered that the following query:
select jsonb_object_agg_unique_strict(i, null) over (order by i) from
           (select i from generate_series(1, 20) g(i));

triggers SIGSEGV:
Core was generated by `postgres: law regression [local] SELECT                                       '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  MemoryChunkGetValue (chunk=0x5af800000001) at ../../../../src/include/utils/memutils_memorychunk.h:224
224             Assert(!HdrMaskIsExternal(chunk->hdrmask));
(gdb) bt
#0  MemoryChunkGetValue (chunk=0x5af800000001) at ../../../../src/include/utils/memutils_memorychunk.h:224
#1  AllocSetAlloc (context=0x5af8d6709330, size=8, flags=<optimized out>) at aset.c:1056
#2  0x00005af8b9b5db40 in palloc (size=size@entry=8) at mcxt.c:1386
#3  0x00005af8b9a177e1 in datumCopy (value=100024796075024, typByVal=typByVal@entry=false, typLen=<optimized out>) at 
datum.c:162
#4  0x00005af8b98071a3 in eval_windowaggregates (winstate=0x5af8d66f8b00) at nodeWindowAgg.c:1053
#5  ExecWindowAgg (pstate=0x5af8d66f8b00) at nodeWindowAgg.c:2367
#6  0x00005af8b97c0465 in ExecProcNode (node=0x5af8d66f8b00) at ../../../src/include/executor/executor.h:319
#7  ExecutePlan (dest=0x5af8d67025c8, direction=<optimized out>, numberTuples=0, sendTuples=true, operation=CMD_SELECT, 
queryDesc=0x5af8d6638620)
     at execMain.c:1707
...
starting from b61aa76e4.

Best regards,
Alexander

view thread (25+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Making jsonb_agg() faster
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox