Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
Date: 2015-06-01 02:17:39
Message-ID: 14012.1433125059@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

I wrote:
> Some of the other machines are showing crashes, not just minor output
> diffs.

I tried HEAD on two different machines, and they are both showing Assert
failures here:

(gdb) bt
#0 0x000000341ce32625 in raise () from /lib64/libc.so.6
#1 0x000000341ce33e05 in abort () from /lib64/libc.so.6
#2 0x00000000007b18f9 in ExceptionalCondition (
conditionName=<value optimized out>, errorType=<value optimized out>,
fileName=<value optimized out>, lineNumber=<value optimized out>)
at assert.c:54
#3 0x000000000072bd2b in pushJsonbValueScalar (pstate=0x7fff149ec388,
seq=<value optimized out>, scalarVal=0x7fff149ec280) at jsonb_util.c:584
#4 0x000000000072c0f7 in pushJsonbValue (pstate=0x7fff149ec388,
seq=<value optimized out>, jbval=<value optimized out>) at jsonb_util.c:528
#5 0x000000000072e1a3 in setPathObject (it=0x7fff149ec390,
path_elems=0x201f9c8, path_nulls=0x201f9e8 "", path_len=1,
st=0x7fff149ec388, level=0, newval=0x1fe9628, create=1 '\001')
at jsonfuncs.c:3724
#6 setPath (it=0x7fff149ec390, path_elems=0x201f9c8, path_nulls=0x201f9e8 "",
path_len=1, st=0x7fff149ec388, level=0, newval=0x1fe9628, create=1 '\001')
at jsonfuncs.c:3682
#7 0x000000000072e912 in jsonb_set (fcinfo=<value optimized out>)
at jsonfuncs.c:3486
#8 0x00000000005d0769 in ExecMakeFunctionResultNoSets (fcache=0x1feacc0,
econtext=0x1feb690, isNull=0x7fff149ec4bf "", isDone=<value optimized out>)
at execQual.c:2018
#9 0x00000000005d12cf in ExecEvalFunc (fcache=0x1feacc0, econtext=0x1feb690,

(gdb) p debug_query_string
$2 = 0x1fa6698 "select jsonb_set('{}','{x}','{\"foo\":123}');"

(gdb) f 3
#3 0x000000000072bd2b in pushJsonbValueScalar (pstate=0x7fff149ec388,
seq=<value optimized out>, scalarVal=0x7fff149ec280) at jsonb_util.c:584
584 Assert(scalarVal->type == jbvString);
(gdb) p *scalarVal
$1 = {type = 33460272, val = {numeric = 0x3400000001, boolean = 1 '\001',
string = {len = 1, val = 0x1fe904c "x"}, array = {nElems = 1,
elems = 0x1fe904c, rawScalar = 0 '\000'}, object = {nPairs = 1,
pairs = 0x1fe904c}, binary = {len = 1, data = 0x1fe904c}}}

Looks like something is forgetting to initialize the type field.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2015-06-01 02:20:02 Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
Previous Message Tom Lane 2015-06-01 02:06:39 Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values