From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | rod(at)iol(dot)ie |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Can you combine text variable together to referenece a VIEW name ? |
Date: | 2007-04-09 20:41:56 |
Message-ID: | 10337.1176151316@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Raymond O'Donnell" <rod(at)iol(dot)ie> writes:
> On 09/04/2007 00:36, Bigjim wrote:
>> I am trying to combine 2 text variable togther to form the name of a
>> VIEW. example
>> SELECT * FROM ( 'april'||'may') ;
> I think you want to use EXECUTE from within a pl/pgsql function to
> construct and execute a query dynamically - have a look at this:
> http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
That's the only way to do it (modulo that you can do this in any of the
PLs not only plpgsql) ... but a more general point is that the OP is
trying to swim against the tide. Almost certainly, rethinking the
design of those views is called for: try to merge them into one view.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-04-09 20:48:05 | Re: Postgres Crash Running PLPGSQL Function on 8.2.3 |
Previous Message | Tom Lane | 2007-04-09 20:38:34 | Re: NEWBIE: How do I get the oldest date contained in 3 tables |