Move postgres fetch into compile