[tarantool-patches] [PATCH 1/1] sql: drop a useless check from lookupName()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Apr 22 21:34:40 MSK 2019


There was a variable used as a counter from 0 to
uint32_t space_def->field_count. Obviously it can't be < 0, but
there was a check for that. Drop it.

The check was revealed during SQL BOOLEAN review, where one of
patches gets rid of some explicit Expr.type assignments.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/drop-useless-check-from-resolve

 src/box/sql/resolve.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index f601bca7b..504096e6d 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -337,18 +337,11 @@ lookupName(Parse * pParse,	/* The parsing context */
 				}
 				if (iCol < (int)space_def->field_count) {
 					cnt++;
-					if (iCol < 0) {
-						pExpr->type =
-							FIELD_TYPE_INTEGER;
-					} else {
-						uint64_t *mask =
-							pExpr->iTable == 0 ?
-							&pParse->oldmask :
-							&pParse->newmask;
-						column_mask_set_fieldno(mask,
-									iCol);
-					}
-					pExpr->iColumn = (i16) iCol;
+					uint64_t *mask = pExpr->iTable == 0 ?
+							 &pParse->oldmask :
+							 &pParse->newmask;
+					column_mask_set_fieldno(mask, iCol);
+					pExpr->iColumn = iCol;
 					pExpr->space_def = space_def;
 					isTrigger = 1;
 				}
-- 
2.20.1 (Apple Git-117)





More information about the Tarantool-patches mailing list