Re: Question from a newbie

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kiarash Bodouhi <kbodouhi(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Question from a newbie
Date: 2004-10-08 05:17:29
Message-ID: 20041008051729.GA49299@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 07, 2004 at 10:55:03PM -0400, Tom Lane wrote:

> return plpy.execute("select getcountrycode(\'9821788\')",1)

plpy.execute() returns a result object; querying a function that
returns a result object will probably look like this:

test=> select test4();
test4
--------------------------------
<PLyResult object at 0x367140>
(1 row)

The code should look more like this:

result = plpy.execute("select getcountrycode(\'9821788\')",1)
return result[0]["getcountrycode"]

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Miles Keaton 2004-10-08 05:22:06 when to use NULL and when to NOT NULL DEFAULT ''
Previous Message Bruno Wolff III 2004-10-08 05:17:27 Re: flattened tables with normalized tables