From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Support multi-dimensional arrays in PL/python.
Date: Wed, 26 Oct 2016 08:03:35 +0000
Message-ID: <E1bzJBP-0001AL-Ov@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Support multi-dimensional arrays in PL/python.
Multi-dimensional arrays can now be used as arguments to a PL/python function
(used to throw an error), and they can be returned as nested Python lists.
This makes a backwards-incompatible change to the handling of composite
types in arrays. Previously, you could return an array of composite types
as "[[col1, col2], [col1, col2]]", but now that is interpreted as a two-
dimensional array. Composite types in arrays must now be returned as
Python tuples, not lists, to resolve the ambiguity. I.e. "[(col1, col2),
(col1, col2)]".
To avoid breaking backwards-compatibility, when not necessary, () is still
accepted for arrays at the top-level, but it is always treated as a
single-dimensional array. Likewise, [] is still accepted for composite types,
when they are not in an array. Update the documentation to recommend using []
for arrays, and () for composite types, with a mention that those other things
are also accepted in some contexts.
This needs to be mentioned in the release notes.
Alexey Grishchenko, Dave Cramer and me. Reviewed by Pavel Stehule.
Discussion: <CAH38_tmbqwaUyKs9yagyRra=SMaT45FPBxk1pmTYcM0TyXGG7Q@mail.gmail.com>
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/94aceed317730953476bec490ce0148b2af3c383
Modified Files
--------------
doc/src/sgml/plpython.sgml | 41 +++-
src/pl/plpython/expected/plpython_composite.out | 16 +-
src/pl/plpython/expected/plpython_types.out | 151 ++++++++++++-
src/pl/plpython/expected/plpython_types_3.out | 151 ++++++++++++-
src/pl/plpython/plpy_typeio.c | 279 ++++++++++++++++++++----
src/pl/plpython/sql/plpython_composite.sql | 12 +-
src/pl/plpython/sql/plpython_types.sql | 86 ++++++++
7 files changed, 673 insertions(+), 63 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: heikki.linnakangas@iki.fi
Subject: Re: pgsql: Support multi-dimensional arrays in PL/python.
In-Reply-To: <E1bzJBP-0001AL-Ov@gemulon.postgresql.org>
References: <E1bzJBP-0001AL-Ov@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox