postgresql: deleting old templates