SETOF

From: Fernando <fernando(at)icreativa(dot)com(dot)mx>
To: pgsql-sql(at)postgresql(dot)org
Subject: SETOF
Date: 2003-03-04 17:44:44
Message-ID: 200303041144.44800.fernando@icreativa.com.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
I am using Postgresql version 7.2.2
I made a small function...

CREATE FUNCTION ejem1(varchar) RETURNS SETOF to varchar as'
SELECT names from mi_tabla WHERE city = $1; '
language ' SQL ';

ejem1
------------
Sergio
Carlos
Fernando

When wanting to obtain several columns I do this...

CREATE FUNCTION ejem2(varchar) RETURNS SETOF mi_tabla as'
SELECT * from mi_tabla WHERE city = $1;'
language ' SQL ';

ejem2
---------------
137956448
137956448
137956448

The number of registries that return is the correct, the question is, because
it does not return the fields of the table, and that is what in its place
this showing to me...
Greetings and thank you very much!

Browse pgsql-sql by date

  From Date Subject
Next Message Guy Fraser 2003-03-04 17:58:21 Convert a text list to text array? Was: Denormalizing during select
Previous Message Josh Berkus 2003-03-04 17:31:14 Re: Database function syntax for inserting records