EXECUTE in a funtion to return a VIEW object ID - Mailing list pgsql-general

From Wilkinson, Jim
Subject EXECUTE in a funtion to return a VIEW object ID
Date
Msg-id 7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET
Whole thread Raw
List pgsql-general

Hi there,

I have tried many ideas to get this working but no luck.

Can some show me or explain what is happening

EXAMPLE

==========

I am trying to read to 2 text fields to combine them togther to form the name of a

VIEW.  example

   SELECT * FROM ( 'april'||'may') ;

I have tried the EXECUTE in a function to PREPARE a dynameic select call;

EXECUTE 'SELECT * FROM '

        || select tablename.text_field1 from tablename

        || select tablename.text_field2 from tablename;

If tablename.text_field1 = May and tablename.text_field2 = Aprl, this function only returns MayApril and not the columns and data that I expected.

What am I doing wrong here?

Has anyone done this before or have any ideas on how to do it ?

Thanks

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [pgsql-www] Re: programmatic way to fetch latest release for a given major.minor version
Next
From: Tom Lane
Date:
Subject: Re: [pgsql-www] Re: programmatic way to fetch latest release for a given major.minor version