How do you read a file name from a table

52 Views Asked by At

I build the following table (it adds yesterday's 8 digit date to some text):

create table DayBefore as select (current_date -interval '1 Days')::timestamp::text;
update daybefore set text = substr (text, 1, 10);
update daybefore set text = replace (text, '-', '');
update daybefore set text = 'MyFile_'||text;

and I can do:

select * from daybefore;

text
---------------------------------
 MyFile_20170126
(1 row)

You'll understand that if the associated script runs daily, this resulting entry also changes daily.

My question is: How do I now refer to the table MyFile_20170126 in a following command ie

select * from 'MyFile_????????' or create table my_table as select * from MyFile_????????

Going batty on this now and I can't upgrade the version of PostgreSQL from 8.2 either :-s

Any help greatly appreciated ... !

0

There are 0 best solutions below