X-Original-To: pgsql-sql@postgresql.org Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id B62DE47681D for ; Wed, 5 Mar 2003 06:47:17 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Mar 05 12:47:18 2003 +0100 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id MAA19448; Wed, 5 Mar 2003 12:47:18 +0100 (MET) Message-ID: <3E65E3C5.1D964F0D@rodos.fzk.de> Date: Wed, 05 Mar 2003 12:47:18 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: fernando@icreativa.com.mx Subject: Re: SETOF Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/147 X-Sequence-Number: 12187 > > CREATE FUNCTION ejem1(varchar) RETURNS SETOF to varchar as'=20 > SELECT names from mi_tabla WHERE city =3D $1; '=20 > language ' SQL ';=20 > > ejem1=20 > ------------ > Sergio=20 > Carlos=20 > Fernando=20 > > When wanting to obtain several columns I do this...=20 > > CREATE FUNCTION ejem2(varchar) RETURNS SETOF mi_tabla as'=20 > SELECT * from mi_tabla WHERE city =3D $1;'=20 > language ' SQL ';=20 > > ejem2=20 > --------------- > 137956448=20 > 137956448=20 > 137956448=20 > > The number of registries that return is the correct, the question is, becau= > se=20 > it does not return the fields of the table, and that is what in its place= > =20 > this showing to me...=20 > Greetings and thank you very much!=20=20=20=20=20=20=20=20=20=20=20=20=20= > =20=20 > You cannot obtain several columns from SQL functions. See the list archives (search for SETOF) for details. You have to use e.g. a plpgsql function instead. Regards, Christoph