Re: Fix PL/Python metadata when there is no result

Peter Eisentraut <peter_e@gmx.net>

From: Peter Eisentraut <peter_e@gmx.net>
To: Jean-Baptiste Quenot <jbq@caraldi.com>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-04-07T17:27:12Z
Lists: pgsql-hackers
On tor, 2012-04-05 at 19:49 +0200, Jean-Baptiste Quenot wrote:
> I consider that this is an error to request metadata when the query does
> not return some.  For example: "UPDATE mytable SET value = 1" does not
> return column metadata, so user is not supposed to col coltypes().  That's
> why I propose to return an error.  coltypes() is supposed to return a
> sequence, not None.  Checking for None is a bad coding practise IMO,
> especially when dealing with lists. 

What would you suggest instead then?