Re: Computed table name in function - Mailing list pgsql-sql

From Scott Marlowe
Subject Re: Computed table name in function
Date
Msg-id dcc563d10710101110i1be5fe9u84171818065d370f@mail.gmail.com
Whole thread Raw
In response to Computed table name in function  ("Ray Madigan" <ray@madigans.org>)
Responses Re: Computed table name in function
List pgsql-sql
On 10/10/07, Ray Madigan <ray@madigans.org> wrote:
> I have a problem that I don't know where to look to understand the problem.
>
> I have a function that I first select to get a table name followed by
> another select into on that table name.  If someone could tell me where to
> look to solve this problem I would appreciate it.
>
> It is something like
>
> DECLARE rec1 Record;
>         rec2 Record;
>
> SELECT aName INTO rec1 FROM tableA WHERE new.xxx = ?;
>
> IF FOUND THEN
>
>     SELECT * INTO rec2 FROM rec1.aName where new.xxx = ?;

You have to build your query as a string then use execute on it.


pgsql-sql by date:

Previous
From: "Ray Madigan"
Date:
Subject: Computed table name in function
Next
From: "Ray Madigan"
Date:
Subject: Re: Computed table name in function