how to returns set of records in PL/python

From: "Anoop G" <anoopmadavoor(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: how to returns set of records in PL/python
Date: 2008-04-07 12:47:22
Message-ID: 1a027d210804070547w3117f195qa279b487b896674d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi ,

Iam new to plpython,how can I return a recordset from a plpython
function?

Is there is any way give me an example;

plpgsql function
--------------------------------

CREATE OR REPLACE FUNCTION function_to_get_all_countries() RETURNS SETOF
RECORD AS $BODY$
DECLARE

r RECORD;

BEGIN

FOR r IN SELECT pk_bint_country_id,vchr_country FROM tbl_country LOOP
RETURN NEXT r;
END LOOP;
RETURN;

END
$BODY$ LANGUAGE 'plpgsql';

How i can get the same result using plpythonu and how I can call the
function (is there any user defined type required like in plpgsql)?

Thanks in advance

Anoop

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2008-04-07 13:01:40 Re: Commit every processed record
Previous Message luke.78@libero.it 2008-04-07 12:46:50 Commit every processed record