pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Date: Tue, 15 Oct 2024 11:00:01 +0000
Message-ID: <18657-1b90ccce2b16bdb8@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18657
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 17.0
Operating system:   Ubuntu 22.04
Description:        

The following query:
SELECT JSON_OBJECT('a': JSON_OBJECTAGG('b': random() RETURNING text) FORMAT
JSON);

triggers a server crash with the following stack trace:
Core was generated by `postgres: law regression [local] SELECT              
                        '.
Program terminated with signal SIGSEGV, Segmentation fault.

#0  0x000055b54914ee1b in ExecBuildAggTrans (...) at execExpr.c:3514
3514                    expr_setup_walker((Node *)
pertrans->aggref->aggdirectargs,
(gdb) bt
#0  0x000055b54914ee1b in ExecBuildAggTrans (...) at execExpr.c:3514
#1  0x000055b549180ee9 in ExecInitAgg (...) at nodeAgg.c:4017
#2  0x000055b54916eb13 in ExecInitNode (...) at execProcnode.c:341
#3  0x000055b549162d3f in InitPlan (...) at execMain.c:968
#4  0x000055b549162732 in standard_ExecutorStart (...) at execMain.c:263
#5  0x000055b54916245a in ExecutorStart (...) at execMain.c:139
#6  0x000055b549411063 in PortalStart (...) at pquery.c:517
#7  0x000055b54940d172 in exec_simple_query (
    query_string=0x55b54b3f4430 "SELECT JSON_OBJECT('a': JSON_OBJECTAGG('b':
random() RETURNING text) FORMAT JSON);") at postgres.c:1239

(gdb) p pertrans->aggref
$1 = (Aggref *) 0x0

First bad commit for this anomaly is b6e1157e7.



view thread (31+ messages)  latest in thread

Message-ID: <18657-1b90ccce2b16bdb8@postgresql.org>
Permalink:  ../18657-1b90ccce2b16bdb8@postgresql.org/
Also on:    postgresql.org/message-id/18657-1b90ccce2b16bdb8@postgresql.org

 · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
  Subject: Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
  In-Reply-To: <18657-1b90ccce2b16bdb8@postgresql.org>

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

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