EXECUTE in a funtion to return a VIEW object ID

From: "Wilkinson, Jim" <Jim(dot)Wilkinson(at)cra-arc(dot)gc(dot)ca>
To: <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: EXECUTE in a funtion to return a VIEW object ID
Date: 2007-04-10 14:34:37
Message-ID: 7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-04-10 14:42:07 Re: Re: [GENERAL] programmatic way to fetch latest release for a given major.minor version
Previous Message Alvaro Herrera 2007-04-10 14:25:35 Re: Re: [GENERAL] programmatic way to fetch latest release for a given major.minor version

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-04-10 14:46:00 Re: Question about undefinably query...
Previous Message A. Kretschmer 2007-04-10 14:05:26 Question about undefinably query...