From: Andrey Fokin <affox@myway.com>
To: pgsql-sql@postgresql.org
Subject: Table name as a variable in SELECT query
Date: Sat, 18 Dec 2010 07:46:38 -0500
Message-ID: <20101218074638.18205@web014.roc2.bluetie.com> (raw)
Hi,
please advise is possible in SELECT query use variable as a table name?
I would like to have for example something like:
CREATE OR REPLACE FUNCTION test_name (tb varchar) RETURNS int AS $$
DECLARE
......
BEGIN
SELECT * FROM $1;
........
Will be grateful for any idea about.
Best regards
Andrey
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: affox@myway.com
Subject: Re: Table name as a variable in SELECT query
In-Reply-To: <20101218074638.18205@web014.roc2.bluetie.com>
* 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