Re: plpgsql return select from multiple tables - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: plpgsql return select from multiple tables
Date
Msg-id 20080910142613.GC4399@alvh.no-ip.org
Whole thread Raw
In response to plpgsql return select from multiple tables  ("Artis Caune" <artis.caune@gmail.com>)
Responses Re: plpgsql return select from multiple tables
List pgsql-general
Artis Caune escribió:
> Hi,
>
> What is the correct way of writing plpgsql function which needs return
> columns from multiple tables?
>
> e.x.:
> SELECT email FROM emails WHERE id = 1
> SELECT backend FROM backends WHERE id = 1
>
> I need plpgsql function return both email and backend in one line, like:
> SELECT email, backend FROM ...

Hmm, maybe

select email, backend from emails, backends where email.id = 1 and
backend.id = 1;
?

You don't need a plpgsql function for this ...

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Filip Rembiałkowski"
Date:
Subject: Re: You need to rebuild PostgreSQL using --with-libxml.
Next
From: "Artis Caune"
Date:
Subject: Re: plpgsql return select from multiple tables