Re: Help making a plpgsql function?

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Bjørn T Johansen <btj(at)havleik(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help making a plpgsql function?
Date: 2006-07-06 01:03:24
Message-ID: F45625B7-43DD-426B-B500-A3FDE866367D@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jul 5, 2006, at 5:41 PM, Bjørn T Johansen wrote:

> btw, just one more thing...
>
> If I join two or more tables, which type should I use for the
> "into" variable (select into t2 *...) where
> t2 would contain fields from more than one table?
>
> I guess using "t2 some_table%rowtype" won't work when joining tables?

I think you can declare t2 as type record (e.g. "t2 record;" in the
declaration). Alternately, you can declare whatever variables you
need to get from the join and select into them explicitly. Something
like:

select into v1, v2, v3 col1, col2, col3 from t1 join t2 ....

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Cser 2006-07-06 01:08:01 Granting COPY TO access
Previous Message Chander Ganesan 2006-07-06 00:26:08 Re: High-Availability Question