Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 754BE2E003C for ; Mon, 7 Apr 2008 09:47:29 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90294-02 for ; Mon, 7 Apr 2008 09:47:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by developer.postgresql.org (Postfix) with ESMTP id 6C2FE2E0047 for ; Mon, 7 Apr 2008 09:47:26 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id f5so498492nfh.23 for ; Mon, 07 Apr 2008 05:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=In+rZbrYfVzWR29gpWx1deQ/5l6MO/A4nnB8kMm5lEA=; b=QBZPLgmKTMqm3RSSR9YLsF+9Q1JOZpcyiRtROxt+SsrMAI4+okYpbpOktGNPe7ge7z4gkGZjuQtejZptnr5S0fVlTzU/BQtqSFwViIZDN/2Cyfi18CgpdPNjPkE2yuJKSnBQWYWjpJ3m8CCgq1nySoYOpbGRABM0tBi/oJibbZo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=QRByv11pGLtGcnH+Bpf8F0AO4a9NQc7SvSr2vXiyL1ir/8neZrS453GsEt36a0BOmmtfzskfBq8I9rZHwL+Z1w8uRX8pYgO/dsXPXVzccppyw8Dmc8rjYxG4asLE7LCaQ8mE/Vwfgmb6NPYwdN3p7S32H6wg8WNbdjtdmMlf9fg= Received: by 10.78.141.12 with SMTP id o12mr577179hud.100.1207572442528; Mon, 07 Apr 2008 05:47:22 -0700 (PDT) Received: by 10.78.118.8 with HTTP; Mon, 7 Apr 2008 05:47:22 -0700 (PDT) Message-ID: <1a027d210804070547w3117f195qa279b487b896674d@mail.gmail.com> Date: Mon, 7 Apr 2008 18:17:22 +0530 From: "Anoop G" To: pgsql-sql@postgresql.org Subject: how to returns set of records in PL/python MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16329_22915949.1207572442520" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200804/39 X-Sequence-Number: 30578 ------=_Part_16329_22915949.1207572442520 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_16329_22915949.1207572442520 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
------=_Part_16329_22915949.1207572442520--