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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Jean-Baptiste Quenot <jbq(at)caraldi(dot)com>
Subject: Re: Fix PL/Python metadata when there is no result
Date: 2012-04-05 17:54:39
Message-ID: 22029.1333648479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-04-05 18:00:53 Re: Last gasp
Previous Message Jean-Baptiste Quenot 2012-04-05 17:49:44 Re: Fix PL/Python metadata when there is no result