Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 740059FA0C0 for ; Sat, 14 Oct 2006 17:28:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26003-09 for ; Sat, 14 Oct 2006 17:28:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web35304.mail.mud.yahoo.com (web35304.mail.mud.yahoo.com [66.163.179.98]) by postgresql.org (Postfix) with SMTP id 06E3F9FB1FF for ; Sat, 14 Oct 2006 17:28:46 -0300 (ADT) Received: (qmail 17632 invoked by uid 60001); 14 Oct 2006 20:28:41 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type; b=NM7muPydcXgbrND9QQj4kH5AMSB68LEAJ37kQcVERlG+SnUh8pWwaXbXTNKyWipXwhJV53tGAHBTfMwDULfAK7d/0Ec+spzH7N3E4zNkjfYZtvdHPgIe/+owLDxj0O9MblatM2vJRAyGZIskkIlurDiR3pdQXHoNnjV1dHZX0X8= ; Message-ID: <20061014202841.17630.qmail@web35304.mail.mud.yahoo.com> Received: from [74.98.189.48] by web35304.mail.mud.yahoo.com via HTTP; Sat, 14 Oct 2006 13:28:41 PDT Date: Sat, 14 Oct 2006 13:28:41 -0700 (PDT) From: Jean-Christophe Roux Subject: plpgsql returning array To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-455368344-1160857721=:15808" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.425 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_40_50, HTML_MESSAGE X-Spam-Level: *** X-Archive-Number: 200610/14 X-Sequence-Number: 3614 --0-455368344-1160857721=:15808 Content-Type: text/plain; charset=ascii Content-Transfer-Encoding: quoted-printable Hello,=0Ain Postgresql, I have a function like this=0A=0ACREATE OR REPLACE = FUNCTION foo()=0A RETURNS text[] AS=0A$BODY$=0Adeclare=0A a text;=0A = b text;=0A arr text[];=0Abegin=0A a =3D 'a';=0A b =3D 'b';=0A = arr[0] =3D a;=0A arr[1] =3D b;=0A return arr;=0Aend;=0A$BODY$=0A LAN= GUAGE 'plpgsql' VOLATILE;=0A=0AIn PHP I would like to read my returned arr.= =0A=0Aprints something like:=0A[0= :1]=3D{a,b}=0A=0A=0AI could parse that results, as a string but I'd rather = have a nice array. Any idea how I should change the function and/or the php= codes? =0AThanks in advance=0AJean=0A=0A=0A=0A --0-455368344-1160857721=:15808 Content-Type: text/html; charset=ascii Content-Transfer-Encoding: quoted-printable
Hello,
in Postgresql, I have a function like this
CREATE OR REPLACE FUNCTION foo()
  RETURNS text[] AS
$BODY= $
declare
    a text;
    b text;    arr text[];
begin
    a =3D 'a';    b =3D 'b';
    arr[0] =3D a;
&nbs= p;   arr[1] =3D b;
    return arr;
end;
$= BODY$
  LANGUAGE 'plpgsql' VOLATILE;

In PHP I would like to = read my returned arr.
<?php
        =     $message =3D pg_fetch_result(pg_query("select foo()"),0,= 0);
            print_r($me= ssage);
?>
prints something like:
[0:1]=3D{a,b}


I co= uld parse that results, as a string but I'd rather have a nice array. Any idea how I should change the = function and/or the php codes?
Thanks in advance
Jean

--0-455368344-1160857721=:15808--