git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 8c035e5) | patch
Support multi-dimensional arrays in PL/python.
2016年10月26日 07:56:30 +0000 (10:56 +0300)
2016年10月26日 07:56:30 +0000 (10:56 +0300)
commit 94aceed317730953476bec490ce0148b2af3c383
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>
doc/src/sgml/plpython.sgml diff | blob | blame | history
src/pl/plpython/expected/plpython_composite.out diff | blob | blame | history
src/pl/plpython/expected/plpython_types.out diff | blob | blame | history
src/pl/plpython/expected/plpython_types_3.out diff | blob | blame | history
src/pl/plpython/plpy_typeio.c diff | blob | blame | history
src/pl/plpython/sql/plpython_composite.sql diff | blob | blame | history
src/pl/plpython/sql/plpython_types.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /