BUG in Prepared transactions from C code using JSON

From: Арсен Арутюнян <arutar(at)bk(dot)ru>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: BUG in Prepared transactions from C code using JSON
Date: 2017-06-23 10:34:07
Message-ID: 1498214047.708561783@f419.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

i've got table with json field.

i'm trying to insert from C function some json data.
i'm using SPI_execute_plan function to do this.

json data prepared with StringInfo
simple example:

StringInfo Message = makeStringInfo();

appendStringInfoString(Message, "{\"Command\":227,\"Status\":2,\"JobId\":4"});
Datum Values[2];
Values[0] = Int32GetDatum(227);
Values[1] = CStringGetDatum(Message->data);

ret = SPI_execute_plan(PreparedTr, Values, NULL, false, 0);

if (ret > 0 && SPI_tuptable != NULL && SPI_processed){
///// Data inserted 
} after selection inserted data looks like 

 "Command":227,"Status":2,"JobId":4}

first { simboll is lost....

Arsen

--
Арсен Арутюнян

Browse pgsql-general by date

  From Date Subject
Next Message Harry Ambrose 2017-06-23 10:46:33 Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100
Previous Message Achilleas Mantzios 2017-06-23 08:14:26 Re: pglogical vs. built-in logical replication in pg-10