我有一系列按日期分区并按以下格式命名的表:
public.schedule_20121018
有没有办法以上述20121018
模式生成日期序列,以便我可以进行 forSELECT
循环information_schema.tables
?
现在我有
SELECT * FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_name like 'schedule_%'
ORDER BY table_name;
但例如,我需要最近 7 天的记录,以便日期序列从20121012
to开始20121018
。谢谢!