Possible Duplicate:
Postgres Dynamic Query Function
I wish to use the returned string from the query below as a table name for other query.
SELECT 'backup_' || TO_CHAR(CURRENT_DATE,'yyyy-mm-dd')
as you can see it returns a string. I wish to use it as an input for another query, e.g.
CREATE TABLE (SELECT 'backup_' || TO_CHAR(CURRENT_DATE,'yyyy-mm-dd'))
AS * SELECT FROM backup
Can it be done? Any clue how?