Re: Fix PL/Python metadata when there is no result - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fix PL/Python metadata when there is no result
Date
Msg-id 22029.1333648479@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fix PL/Python metadata when there is no result  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The alternatives are now to introduce a new function like has_rows()
> that returns True iff result rows exist and therefore result metadata
> can be fetched, or go back to having coltypes() et al. return None when
> no metadata exists.  I'm in favor of the latter, because the former
> would add somewhat needless complications and doesn't really add any
> robustness or the like.

Seems sensible to me.

We had better also document what nrows() really does.  Should we also
introduce a new function that is "number of rows in the resultset",
rather than depending on len()?  I think it might be useful, or at least
consistent, to have a function defined as "number of rows, or None if
the resultset does not contain rows".  In particular, I think it is
important to be able to distinguish between a command result (which
cannot possibly contain rows) and a query result that happens to contain
zero rows.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jean-Baptiste Quenot
Date:
Subject: Re: Fix PL/Python metadata when there is no result
Next
From: Robert Haas
Date:
Subject: Re: Last gasp