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

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
Дата
Msg-id 556BC3FE.2020105@dunslane.net
обсуждение исходный текст
Ответ на Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
On 05/31/2015 10:17 PM, Tom Lane wrote:
> 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.


Aha!

I fixed a bug regarding that recently, and now I can't find the fix. But
that gives me enough clues to be able to fix it, thanks.

cheers

andrew







В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Rename jsonb_replace to jsonb_set and allow it to add new values
Следующее
От: Andrew Dunstan
Дата:
Сообщение: pgsql: Add a couple of missing JsonbValue type initialisers.