Re: Jsonb transform for pl/python

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru>
Subject: Re: Jsonb transform for pl/python
Date: 2018-03-12 15:26:36
Message-ID: f07b3955-e3e7-b410-b4fc-dae290774cf9@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-jsonb_plpython-extension-v6.patch.gz application/gzip 14.0 KB
0001-jsonb_plpython-extension-v5-v6-delta.patch text/x-patch 15.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-03-12 15:27:30 Re: PATCH: Unlogged tables re-initialization tests
Previous Message Darafei Komяpa Praliaskouski 2018-03-12 15:24:36 Re: Cast jsonb to numeric, int, float, bool