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

PL/Python: Fix crash when colnames() etc. called without result set

The result object methods colnames() etc. would crash when called
after a command that did not produce a result set.  Now they throw an
exception.

discovery and initial patch by Jean-Baptiste Quenot
This commit is contained in:
Peter Eisentraut
2012-04-15 20:23:08 +03:00
parent 4efbb7d04f
commit c03523ed3f
4 changed files with 49 additions and 13 deletions

View File

@ -935,6 +935,14 @@ foo = rv[i]["my_column"]
Return a list of column names, list of column type OIDs, and list of
type-specific type modifiers for the columns, respectively.
</para>
<para>
These methods raise an exception when called on a result object from
a command that did not produce a result set, e.g.,
<command>UPDATE</command> without <literal>RETURNING</literal>, or
<command>DROP TABLE</command>. But it is OK to use these methods on
a result set containing zero rows.
</para>
</listitem>
</varlistentry>
</variablelist>