[tarantool-patches] Re: [PATCH v1 06/21] sql: remove SQL_NOTFOUND error/status code

n.pettik korablev at tarantool.org
Sat May 25 17:58:19 MSK 2019



> On 25 May 2019, at 13:44, imeevma at tarantool.org wrote:
> 
> Removing this error/status code is part of getting rid of the SQL
> error system.
> ---
> src/box/sql/os_unix.c |  2 +-
> src/box/sql/sqlInt.h  |  2 --
> src/box/sql/where.c   | 13 ++-----------
> 3 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/src/box/sql/where.c b/src/box/sql/where.c
> index 0b1ccd9..060dfee 100644
> --- a/src/box/sql/where.c
> +++ b/src/box/sql/where.c
> @@ -1528,21 +1528,14 @@ whereEqualScanEst(Parse * pParse,	/* Parsing & code generating context */
> 	assert(nEq >= 1);
> 	assert(nEq <= (int) p->key_def->part_count);
> 	assert(pBuilder->nRecValid < nEq);
> -
> -	/* If values are not available for all fields of the index to the left
> -	 * of this one, no estimate can be made. Return SQL_NOTFOUND.
> -	 */
> -	if (pBuilder->nRecValid < (nEq - 1)) {
> -		return SQL_NOTFOUND;
> -	}
> +	assert(pBuilder->nRecValid >= (nEq - 1));

Taking into consideration assert above, it could
be replaced with assert(pBuilder->nRecValid == nEq - 1);
Btw, this function doesn’t seem to be called at all:
unreachable() assert doesn’t fire. I can assume that it is
connected with stat tables.





More information about the Tarantool-patches mailing list