SELECT *
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_name in (
select 'schedule_' || to_char(d, 'YYYYMMDD')
from
generate_series(current_date - 7, current_date - 1, '1 day') s(d)
)
ORDER BY table_name;
Anciennes versions de Postgresql :
SELECT *
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_name in (
select 'schedule_' || to_char(current_date - d, 'YYYYMMDD')
from
generate_series(7, 1, -1) s(d)
)
ORDER BY table_name;