diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-03 16:10:50 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-03 16:10:50 -0400 |
commit | 8b6010b8350a1756cd85595705971df81b5ffc07 (patch) | |
tree | eda51b5b21c1030a24f0be7bb3a11b770aba5c7a /src/pl/plpython/plpy_spi.c | |
parent | f545d233ebce6971b6f9847680e48b679e707d22 (diff) | |
download | postgresql-8b6010b8350a1756cd85595705971df81b5ffc07.tar.gz postgresql-8b6010b8350a1756cd85595705971df81b5ffc07.zip |
Improve support for composite types in PL/Python.
Allow PL/Python functions to return arrays of composite types.
Also, fix the restriction that plpy.prepare/plpy.execute couldn't
handle query parameters or result columns of composite types.
In passing, adopt a saner arrangement for where to release the
tupledesc reference counts acquired via lookup_rowtype_tupdesc.
The callers of PLyObject_ToCompositeDatum were doing the lookups,
but then the releases happened somewhere down inside subroutines
of PLyObject_ToCompositeDatum, which is bizarre and bug-prone.
Instead release in the same function that acquires the refcount.
Ed Behn and Ronan Dunklau, reviewed by Abhijit Menon-Sen
Diffstat (limited to 'src/pl/plpython/plpy_spi.c')
-rw-r--r-- | src/pl/plpython/plpy_spi.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c index 060d514a80d..6c3eefff68b 100644 --- a/src/pl/plpython/plpy_spi.c +++ b/src/pl/plpython/plpy_spi.c @@ -130,12 +130,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args) plan->types[i] = typeId; typeStruct = (Form_pg_type) GETSTRUCT(typeTup); - if (typeStruct->typtype != TYPTYPE_COMPOSITE) - PLy_output_datum_func(&plan->args[i], typeTup); - else - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("plpy.prepare does not support composite types"))); + PLy_output_datum_func(&plan->args[i], typeTup); ReleaseSysCache(typeTup); } |