Re: JsonbValue to Jsonb conversion - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: JsonbValue to Jsonb conversion
Date
Msg-id CAFj8pRCpG9+6Lrxp9aM3D-QuJYCcBG_L2sg+fLfXoDm2BB-YdQ@mail.gmail.com
Whole thread Raw
In response to Re: JsonbValue to Jsonb conversion  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: JsonbValue to Jsonb conversion
List pgsql-hackers
Hi

A JsonSemAction sem is not well initialized

a array_element_start is not initialized and enforces sigfault on my comp

*** ./utils/adt/jsonb.c.orig    2014-10-13 16:37:00.479708142 +0200
--- ./utils/adt/jsonb.c    2014-10-13 16:36:33.704650644 +0200
***************
*** 786,791 ****
--- 786,793 ----
                      sem.scalar = jsonb_in_scalar;
                      sem.object_field_start = jsonb_in_object_field_start;
 
+                     sem.array_element_start = NULL;
+
                      pg_parse_json(lex, &sem);
 
                  }

I am not sure, if this fix is valid, but all tests are passed now

Regards

Pavel

2014-10-13 16:21 GMT+02:00 Pavel Stehule <pavel.stehule@gmail.com>:


2014-10-13 16:19 GMT+02:00 Tom Lane <tgl@sss.pgh.pa.us>:
Pavel Stehule <pavel.stehule@gmail.com> writes:
> I checked this last version - warning is out, but SIGFAULT on jsonb test is
> there .. I rechecked it with clang compiler, but result is same

Stack trace please?

(gdb) bt
#0  0x0000000000000072 in ?? ()
#1  0x000000000087d598 in parse_array_element (lex=0x2880118, sem=0x7fffb4f02508) at json.c:461
#2  0x0000000000878da7 in parse_array (lex=0x2880118, sem=0x7fffb4f02508) at json.c:505
#3  0x000000000087d837 in parse_object_field (lex=0x2880118, sem=0x7fffb4f02508) at json.c:391
#4  0x0000000000878cb2 in parse_object (lex=0x2880118, sem=0x7fffb4f02508) at json.c:432
#5  0x000000000087831c in pg_parse_json (lex=0x2880118, sem=0x7fffb4f02508) at json.c:297
#6  0x000000000087f484 in datum_to_jsonb (val=42202912, is_null=0 '\000', result=0x7fffb4f02800,
    tcategory=JSONBTYPE_JSON, outfuncoid=322, key_scalar=0 '\000') at jsonb.c:789
#7  0x000000000087fce7 in add_jsonb (val=42202912, is_null=0 '\000', result=0x7fffb4f02800, val_type=114,
    key_scalar=0 '\000') at jsonb.c:1050
#8  0x000000000087fbcc in jsonb_build_object (fcinfo=0x287e2c0) at jsonb.c:1155
#9  0x000000000066d179 in ExecMakeFunctionResultNoSets (fcache=0x287e250, econtext=0x287e060, isNull=0x287eca8 "",
    isDone=0x287edc0) at execQual.c:1992
#10 0x000000000066776f in ExecEvalFunc (fcache=0x287e250, econtext=0x287e060, isNull=0x287eca8 "", isDone=0x287edc0)
    at execQual.c:2383
#11 0x000000000066c3bb in ExecTargetList (targetlist=0x287ed90, econtext=0x287e060, values=0x287ec90,
    isnull=0x287eca8 "", itemIsDone=0x287edc0, isDone=0x7fffb4f02aac) at execQual.c:5265
#12 0x000000000066c2c2 in ExecProject (projInfo=0x287ecc0, isDone=0x7fffb4f02aac) at execQual.c:5480
#13 0x0000000000689ceb in ExecResult (node=0x287df50) at nodeResult.c:155
#14 0x0000000000661987 in ExecProcNode (node=0x287df50) at execProcnode.c:373
#15 0x000000000065dd46 in ExecutePlan (estate=0x287de40, planstate=0x287df50, operation=CMD_SELECT,
    sendTuples=1 '\001', numberTuples=0, direction=ForwardScanDirection, dest=0x283fa00) at execMain.c:1481
#16 0x000000000065dc70 in standard_ExecutorRun (queryDesc=0x2809d50, direction=ForwardScanDirection, count=0)
    at execMain.c:308
#17 0x000000000065db3f in ExecutorRun (queryDesc=0x2809d50, direction=ForwardScanDirection, count=0)
    at execMain.c:256
#18 0x00000000007ec70c in PortalRunSelect (portal=0x2807bc0, forward=1 '\001', count=0, dest=0x283fa00)
    at pquery.c:946
#19 0x00000000007ec229 in PortalRun (portal=0x2807bc0, count=9223372036854775807, isTopLevel=1 '\001',
    dest=0x283fa00, altdest=0x283fa00, completionTag=0x7fffb4f02ec0 "") at pquery.c:790
#20 0x00000000007e7f7c in exec_simple_query (
    query_string=0x283e1a0 "SELECT jsonb_build_object('e',json '{\"x\": 3, \"y\": [1,2,3]}');") at postgres.c:1045
#21 0x00000000007e72cb in PostgresMain (argc=1, argv=0x27e5838, dbname=0x27e56e8 "postgres",
---Type <return> to continue, or q <return> to quit---q
username=0x27e56d0 "paveQuit

Regards

Pavel
 

                        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: JsonbValue to Jsonb conversion
Next
From: Robert Haas
Date:
Subject: Re: UPSERT wiki page, and SQL MERGE syntax