Re: BUG #17227: segmentation fault with jsonb_to_recordset

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: bernddorn@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2021-10-13T14:28:55Z
Lists: pgsql-bugs
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Can you provide some sample data that would reproduce the crash?

Huh?  It's a self-contained example.  I'm seeing this back-trace
on HEAD:

#0  pg_detoast_datum (datum=0x40) at fmgr.c:1724
#1  0x00000000008a2c9a in jsonb_path_query_array_internal (fcinfo=0x19767d8, 
    tz=<optimized out>) at jsonpath_exec.c:463
#2  0x00000000006ab46e in ExecInterpExpr (state=0x19766e8, econtext=0x1976560, 
    isnull=<optimized out>) at execExprInterp.c:1260
#3  0x00000000006b8c04 in ExecEvalExpr (isNull=0x1991688, econtext=0x1976560, 
    state=<optimized out>) at ../../../src/include/executor/executor.h:320
#4  ExecEvalFuncArgs (fcinfo=0x1991660, argList=0x198dd78, econtext=0x1976560)
    at execSRF.c:846
#5  0x00000000006b8f42 in ExecMakeTableFunctionResult (setexpr=0x1976650, 
    econtext=0x1976560, argContext=0x1991540, expectedDesc=0x198de28, 
    randomAccess=false) at execSRF.c:181
#6  0x00000000006cb5ef in FunctionNext (node=node@entry=0x1976348)
    at nodeFunctionscan.c:94
#7  0x00000000006b9b91 in ExecScanFetch (
    recheckMtd=0x6cb2e0 <FunctionRecheck>, accessMtd=0x6cb2f0 <FunctionNext>, 
    node=0x1976348) at execScan.c:133
#8  ExecScan (node=0x1976348, accessMtd=0x6cb2f0 <FunctionNext>, 
    recheckMtd=0x6cb2e0 <FunctionRecheck>) at execScan.c:182
#9  0x00000000006e06d4 in ExecProcNode (node=0x1976348)
    at ../../../src/include/executor/executor.h:257
#10 ExecNestLoop (pstate=0x1975060) at nodeNestloop.c:160

			regards, tom lane



Commits

  1. Fix planner error with pulling up subquery expressions into function RTEs.

  2. Allow functions-in-FROM to be pulled up if they reduce to constants.