I'm using the COPY ... FROM ... WITH CSV... syntax however I'm finding that the filename can be easily derived from the value stored elsewhere in the database and that changing it in a script all the time is a maintenance nightmare.
Is it possible to SELECT the filename ie:
COPY ... FROM (SELECT filename FROM mytable WHERE x=1) WITH CSV...
Thanks, p.