Re: Jsonb transform for pl/python - Mailing list pgsql-hackers

From Nikita Glukhov
Subject Re: Jsonb transform for pl/python
Date
Msg-id f07b3955-e3e7-b410-b4fc-dae290774cf9@postgrespro.ru
Whole thread Raw
In response to Re: Jsonb transform for pl/python  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Jsonb transform for pl/python  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On 01.02.2018 19:06, Peter Eisentraut wrote:
> On 1/12/18 10:43, Aleksander Alekseev wrote:
>> The following review has been posted through the commitfest application:
>> make installcheck-world:  tested, passed
>> Implements feature:       tested, passed
>> Spec compliant:           tested, passed
>> Documentation:            tested, passed
>>
>> LGTM.
>>
>> The new status of this patch is: Ready for Committer
> I've been working on polishing this a bit.  I'll keep working on it.  It
> should be ready to commit soon.

Hi.

I have reviewed this patch.  Attached new 6th version of the patch with
v5-v6 delta-patch.

  * Added out of memory checks after the following function calls:
    - PyList_New()
    - PyDict_New()
    - PyString_FromStringAndSize()  (added PyString_FromJsonbValue())

  * Added Py_XDECREF() for key-value pairs and list elements after theirs
    appending because PyDict_SetItem() and PyList_Append() do not steal
    references (see also hstore_plpython code).

  * Removed unnecessary JsonbValue heap-allocations in PyObject_ToJsonbValue().

  * Added iterating to the end of iterator in PyObject_FromJsonb() for correct
    freeing of JsonbIterators.

  * Passed JsonbParseState ** to PyXxx_ToJsonbValue() functions.

  * Added transformation of Python tuples into JSON arrays because standard
    Python JSONEncoder encoder does the same.
    (See https://docs.python.org/2/library/json.html#py-to-json-table)


-- 
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


Attachment

pgsql-hackers by date:

Previous
From: Darafei "Komяpa" Praliaskouski
Date:
Subject: Re: Cast jsonb to numeric, int, float, bool
Next
From: Peter Eisentraut
Date:
Subject: Re: PATCH: Unlogged tables re-initialization tests