pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
Cc: fernando@icreativa.com.mx
Subject: Re: SETOF
Date: Wed, 05 Mar 2003 12:47:18 +0100
Message-ID: <3E65E3C5.1D964F0D@rodos.fzk.de> (raw)

>
> 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





view thread (8+ messages)  latest in thread

Message-ID: <3E65E3C5.1D964F0D@rodos.fzk.de>
Permalink:  ../3E65E3C5.1D964F0D@rodos.fzk.de/
Also on:    postgresql.org/message-id/3E65E3C5.1D964F0D@rodos.fzk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, fernando@icreativa.com.mx
  Subject: Re: SETOF
  In-Reply-To: <3E65E3C5.1D964F0D@rodos.fzk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox