From d17f32f28990cce180dd88ea4abb58186f2c0190 Mon Sep 17 00:00:00 2001
From: Bulat Niatshin <niatshin@tarantool.org>
Date: Wed, 20 Dec 2017 15:52:09 +0300
Subject: [PATCH] Revert "sql: workaround. Allow NILs comparison for scalars."

This reverts commit a2f574e3ca224aeaef8483222e388d018f5c2e17.
---
 src/box/key_def.cc                  |  2 +-
 src/box/tuple_compare.cc            | 10 +---------
 test/engine/indices_any_type.result |  5 ++---
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/box/key_def.cc b/src/box/key_def.cc
index d71cff3b6c..5fcb73d7be 100644
--- a/src/box/key_def.cc
+++ b/src/box/key_def.cc
@@ -87,7 +87,7 @@ const uint32_t key_mp_type[] = {
 	/* [FIELD_TYPE_BOOLEAN]  =  */ 1U << MP_BOOL,
 	/* [FIELD_TYPE_SCALAR]   =  */ (1U << MP_UINT) | (1U << MP_INT) |
 		(1U << MP_FLOAT) | (1U << MP_DOUBLE) | (1U << MP_STR) |
-		(1U << MP_BIN) | (1U << MP_BOOL) | (1U << MP_NIL),
+		(1U << MP_BIN) | (1U << MP_BOOL),
 	/* [FIELD_TYPE_ARRAY]    =  */ 1U << MP_ARRAY,
 	/* [FIELD_TYPE_MAP]      =  */ (1U << MP_MAP),
 };
diff --git a/src/box/tuple_compare.cc b/src/box/tuple_compare.cc
index 923dc66309..cf8fc130e8 100644
--- a/src/box/tuple_compare.cc
+++ b/src/box/tuple_compare.cc
@@ -314,17 +314,9 @@ mp_compare_bin(const char *field_a, const char *field_b)
 	return COMPARE_RESULT(size_a, size_b);
 }
 
-static int
-mp_compare_nil(const char *field_a, const char *field_b)
-{
-	(void)field_a;
-	(void)field_b;
-	return 0;
-}
-
 typedef int (*mp_compare_f)(const char *, const char *);
 static mp_compare_f mp_class_comparators[] = {
-	/* .MP_CLASS_NIL    = */ mp_compare_nil,
+	/* .MP_CLASS_NIL    = */ NULL,
 	/* .MP_CLASS_BOOL   = */ mp_compare_bool,
 	/* .MP_CLASS_NUMBER = */ mp_compare_number,
 	/* .MP_CLASS_STR    = */ mp_compare_str,
diff --git a/test/engine/indices_any_type.result b/test/engine/indices_any_type.result
index dccbcb00dc..8158bda4e7 100644
--- a/test/engine/indices_any_type.result
+++ b/test/engine/indices_any_type.result
@@ -698,7 +698,7 @@ i4_1 = s4:create_index('my_space5_idx1', {type='TREE', parts={1, 'scalar', 2, 'i
 ...
 s4:insert({mp.NULL, 1, 1, 1})
 ---
-- [null, 1, 1, 1]
+- error: 'Tuple field 1 type does not match one required by operation: expected scalar'
 ...
 s4:insert({2, mp.NULL, 2, 2}) -- all nulls must fail
 ---
@@ -782,7 +782,7 @@ s5:insert({7, true})
 ...
 s5:insert({8, mp.NULL}) -- must fail
 ---
-- [8, null]
+- error: 'Tuple field 2 type does not match one required by operation: expected scalar'
 ...
 s5:insert({9, -40.5})
 ---
@@ -809,7 +809,6 @@ s5:select{}
   - [5, 123]
   - [6, true]
   - [7, true]
-  - [8, null]
   - [9, -40.5]
   - [10, -39.5]
   - [11, -38.5]
-- 
GitLab