Postgresql Function Array Argument Must Be A Range Error