pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wilkinson, Jim <Jim.Wilkinson@cra-arc.gc.ca>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
Subject: EXECUTE in a funtion to return a VIEW object ID
Date: Tue, 10 Apr 2007 10:34:37 -0400
Message-ID: <7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET> (raw)

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

Message-ID: <7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET>
Permalink:  ../7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET/
Also on:    postgresql.org/message-id/7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Jim.Wilkinson@cra-arc.gc.ca, pgsql-general@postgresql.org
  Subject: Re: EXECUTE in a funtion to return a VIEW object ID
  In-Reply-To: <7CCC5BEF5E72394C963E529B54EB4A642A19C5@SD01ITMV12.PROD.NET>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox