Fix postgres db check