Re: Selects in server side functions - Mailing list pgsql-general

From Alex Pilosov
Subject Re: Selects in server side functions
Date
Msg-id Pine.BSO.4.10.10010272330420.2291-100000@spider.pilosoft.com
Whole thread Raw
In response to Selects in server side functions  ("Neil Davis" <npdavis@hotmail.com>)
List pgsql-general
On Fri, 27 Oct 2000, Neil Davis wrote:

> Hello,
> I am trying to figure out how to return more than one field using "SETOF".
SETOF is to return more than one record, not more than one field. Also,
SETOF is only currently working for SQL language functions.

What you probably need is following:
create procedure x returns foo ....

and create a table foo with list of fields you want to return.

That will work IFF you are not calling this function directly from the
client, but are accessing it from plpgsql code. If you are accessing it
from a client, it won't work. I don't know what will :)

> I can concatenate the fields in the select statement down to one and use SETOF Text to return them, then split them
backapart in my code. This is a bit kludgy though. I would rather do this correctly and efficiently. In most RDBMS you
caneasily deal with multiple columns in server side procedures that contain a SELECT, but I can find nothing about how
todo this in PostGreSQL Documentation or anywhere else. 
>
> How can you do this with PostGreSQL? If you can, is it better to do this this way, or better to put the query inline
inthe code? 
>
> Please respond to the email at the bottom.
>
> thx,
> Neil P Davis
> npdavis@hotmail.com
>


pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: 7.1 release date ?
Next
From: Phil
Date:
Subject: dsn to postgres database.