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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Jean-Baptiste Quenot <jbq(at)caraldi(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix PL/Python metadata when there is no result
Date: 2012-03-07 20:47:22
Message-ID: 1331153242.12416.5.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On lör, 2012-02-25 at 18:03 +0100, Jean-Baptiste Quenot wrote:
> IMO raising an error is much better because:
>
> 1) It is not a valid usecase to retrieve result metadata when no rows
> are expected to be returned

Which led me to think, how are you actually expected to know when no
rows are expected to be returned, in PL/Python? You can look at
result.status(), which returns a numeric SPI status, but that seems
fragile. I notice that result.nrows() returns None when no rows are
returned. Is that good enough? In that case, we should document that
and then make the new functions throw exceptions like you suggest.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2012-03-07 20:53:37 Re: CLUSTER VERBOSE (9.1.3)
Previous Message Robert Haas 2012-03-07 20:44:58 Re: WARNING: concurrent insert in progress within table "resource"