[Tarantool-patches] [PATCH v1 6/7] sql: remove implicit cast from OP_MustBeInt

imeevma at tarantool.org imeevma at tarantool.org
Wed Jul 28 23:51:18 MSK 2021


This patch removes implicit casting from STRING to number in
OP_MustBeInt opcode.

Part of #4470
---
 src/box/sql/vdbe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 81551acf3..89e77baee 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -1435,7 +1435,8 @@ case OP_AddImm: {            /* in1 */
  */
 case OP_MustBeInt: {            /* jump, in1 */
 	pIn1 = &aMem[pOp->p1];
-	if (mem_to_int_precise(pIn1) != 0) {
+	enum field_type type = FIELD_TYPE_INTEGER;
+	if (!mem_is_num(pIn1) || mem_cast_implicit_number(pIn1, type) != 0) {
 		if (pOp->p2 != 0)
 			goto jump_to_p2;
 		diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
-- 
2.25.1



More information about the Tarantool-patches mailing list