Re: Question from a newbie - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Question from a newbie
Date
Msg-id 20041008051729.GA49299@winnie.fuhr.org
Whole thread Raw
In response to Re: Question from a newbie  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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/

pgsql-general by date:

Previous
From: Dennis Gearon
Date:
Subject: Re: flattened tables with normalized tables
Next
From: Miles Keaton
Date:
Subject: when to use NULL and when to NOT NULL DEFAULT ''