[tarantool-patches] Re: [PATCH v3 7/9] sql: rework four semantic errors

n.pettik korablev at tarantool.org
Tue Mar 5 12:16:16 MSK 2019


> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index 7ea344b..ffcb455 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -730,9 +730,9 @@ sqlExprCheckHeight(Parse * pParse, int nHeight)
> 	int rc = SQL_OK;
> 	int mxHeight = pParse->db->aLimit[SQL_LIMIT_EXPR_DEPTH];
> 	if (nHeight > mxHeight) {
> -		sqlErrorMsg(pParse,
> -				"Expression tree is too large (maximum depth %d)",
> -				mxHeight);
> +		diag_set(ClientError, ER_SQL_PARSER_LIMIT, "Number of nodes "\
> +			 "in expression tree", 0, "", nHeight, mxHeight);
> +		pParse->is_aborted = true;
> 		rc = SQL_ERROR;
> 	}
> 	return rc;
> @@ -1174,9 +1174,9 @@ sqlExprAssignVarNumber(Parse * pParse, Expr * pExpr, u32 n)
> 			testcase(i == SQL_BIND_PARAMETER_MAX - 1);
> 			testcase(i == SQL_BIND_PARAMETER_MAX);
> 			if (!is_ok || i < 1 || i > SQL_BIND_PARAMETER_MAX) {
> -				sqlErrorMsg(pParse,
> -						"variable number must be between $1 and $%d",
> -						SQL_BIND_PARAMETER_MAX);
> +				diag_set(ClientError, ER_SQL_BIND_PARAMETER_MAX,
> +					 SQL_BIND_PARAMETER_MAX);

You still can get here if i < 1. Please add an assertion here.






More information about the Tarantool-patches mailing list