PL/Python - Execute return results - Mailing list pgsql-general

From Dean Grubb
Subject PL/Python - Execute return results
Date
Msg-id 539ac17c0809212035l1807349ej589e18f4ca54064d@mail.gmail.com
Whole thread Raw
Responses Re: PL/Python - Execute return results  (Tino Wildenhain <tino@wildenhain.de>)
List pgsql-general
Hi,

plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name =
$1", [ "text" ])
rv = plpy.execute(plan, [ "name" ], 5)
return rv["last_name"]

If the SELECT command does not return any results, how do I
catch/check for this?

if rv == {} ?

or maybe

try:
  rv = plpy.execute(plan, [ "name" ], 5)
  return rv["last_name"]
except:
  ...
else:
  ...

can't seem to get either to work.

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: R-tree, order by, limit
Next
From: Craig Ringer
Date:
Subject: Re: i can't drop an idex