Re: Selecting from a dynamic name

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Jason Kwok" <pg(at)newhonest(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Selecting from a dynamic name
Date: 2001-11-30 03:37:28
Message-ID: GNELIHDDFBOCMGBFGEFOAEKDCAAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You could try writing another function to do the select, and construct the
query using string manipulation...

Chris
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Jason Kwok
Sent: Friday, 30 November 2001 10:43 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] Selecting from a dynamic name

I have asked this question before, but still I'm stuck.
How can I select from a table with a name that's returned by a function?

eg : I have a function named tablename() which return 'mytable'
If I already have a table called mytable, can I :

select * from tablename();

pgadmin2 returns an error :
ERROR : parser : parse error at or near "("

==
====
Best Regards
Jason Kwok
==============
====

---
Virus Free
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 2001/11/24

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Bertheau 2001-11-30 07:53:28 Re: contracting tables
Previous Message Jason Kwok 2001-11-30 02:43:26 Selecting from a dynamic name