BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Date: 2024-10-15 11:00:01
Message-ID: 18657-1b90ccce2b16bdb8@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18657
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Milhiser 2024-10-15 16:43:52 Re: Reference to - BUG #18349: ERROR: invalid DSA memory alloc request size 1811939328, CONTEXT: parallel worker
Previous Message PG Bug reporting form 2024-10-15 09:58:35 BUG #18656: "STABLE" function sometimes does not see changes