1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

PL/Python: Add result metadata functions

Add result object functions .colnames, .coltypes, .coltypmods to
obtain information about the result column names and types, which was
previously not possible in the PL/Python SPI interface.

reviewed by Abhijit Menon-Sen
This commit is contained in:
Peter Eisentraut
2012-01-30 21:38:52 +02:00
parent c6ea8ccea6
commit ee7fa66b19
6 changed files with 80 additions and 5 deletions

View File

@ -886,9 +886,12 @@ $$ LANGUAGE plpythonu;
list or dictionary object. The result object can be accessed by
row number and column name. It has these additional methods:
<function>nrows</function> which returns the number of rows
returned by the query, and <function>status</function> which is the
<function>SPI_execute()</function> return value. The result object
can be modified.
returned by the query, <function>status</function> which is the
<function>SPI_execute()</function> return value,
<function>colnames</function> which is the list of column names,
<function>coltypes</function> which is the list of column type OIDs,
and <function>coltypmods</function> which is the list of type-specific type
modifiers for the columns. The result object can be modified.
</para>
<para>