Fix type error for postgresql