From b20cd6b67437ff37b07adc43ec5ab8d73c83447f Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Wed, 19 Jun 2013 17:49:03 +0400
Subject: [PATCH] Allow empty tuples in tuple_update and remove
 ER_TUPLE_IS_EMPTY error code

---
 include/errcode.h        |  2 +-
 src/box/tuple_update.cc  |  3 ---
 test/box/lua.result      |  2 +-
 test/box/lua_misc.result | 15 +++++++--------
 test/lib/sql_ast.py      |  2 +-
 5 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/include/errcode.h b/include/errcode.h
index 2675b113e6..1128e8e25e 100644
--- a/include/errcode.h
+++ b/include/errcode.h
@@ -77,7 +77,7 @@ enum { TNT_ERRMSG_MAX = 512 };
 	/* 23 */_(ER_RESERVED23,		0, "Reserved23") \
 		/* end of silverproxy error codes */ \
 	/* 24 */_(ER_UNUSED24,			2, "Unused24") \
-	/* 25 */_(ER_TUPLE_IS_EMPTY,		2, "UPDATE error: the new tuple has no fields") \
+	/* 25 */_(ER_UNUSED25,			2, "Unused25") \
 	/* 26 */_(ER_FIBER_STACK,		2, "Can not create a new fiber: recursion limit reached") \
 	/* 27 */_(ER_UNUSED27,			2, "Unused27") \
 	/* 28 */_(ER_UNUSED28,			2, "Unused28") \
diff --git a/src/box/tuple_update.cc b/src/box/tuple_update.cc
index 2e5d7f4640..2149863b6e 100644
--- a/src/box/tuple_update.cc
+++ b/src/box/tuple_update.cc
@@ -528,9 +528,6 @@ update_calc_new_tuple_length(struct tuple_update *update)
 	if (update->new_tuple_size > UINT32_MAX)
 		tnt_raise(ClientError, ER_TUPLE_IS_TOO_LONG,
 			  update->new_tuple_size);
-
-	if (update->new_tuple_size == 0)
-		tnt_raise(ClientError, ER_TUPLE_IS_EMPTY);
 }
 
 static void
diff --git a/test/box/lua.result b/test/box/lua.result
index f5d95e967c..bcaca2c74f 100644
--- a/test/box/lua.result
+++ b/test/box/lua.result
@@ -1186,7 +1186,7 @@ Found 1 tuple:
 [896755060]
 lua box.update(0, 'tes5', '#p', 0, '')
 ---
-error: 'UPDATE error: the new tuple has no fields'
+error: 'Illegal parameters, tuple must have all indexed fields'
 ...
 lua box.space[0]:truncate()
 ---
diff --git a/test/box/lua_misc.result b/test/box/lua_misc.result
index 31495fe9f8..d931d1f6be 100644
--- a/test/box/lua_misc.result
+++ b/test/box/lua_misc.result
@@ -106,25 +106,24 @@ box.error.ER_PROC_RET: 12290
 box.error.ER_TUPLE_IS_TOO_LONG: 11010
 box.error.ER_EXACT_MATCH: 11522
 box.error.ER_SECONDARY: 770
-box.error.ER_SPACE_DISABLED: 13314
 box.error.ER_OK: 0
-box.error.ER_TUPLE_FOUND: 14082
+box.error.ER_NO_SUCH_INDEX: 13570
 box.error.ER_TUPLE_NOT_FOUND: 12546
 box.error.ER_FIBER_STACK: 6658
-box.error.ER_SPLICE: 10754
-box.error.ER_NO_SUCH_FIELD: 13826
+box.error.ER_UNKNOWN_UPDATE_OP: 11266
+box.error.ER_TUPLE_FOUND: 14082
 box.error.ER_UNSUPPORTED: 2562
 box.error.ER_INJECTION: 2306
-box.error.ER_NO_SUCH_INDEX: 13570
+box.error.ER_NO_SUCH_FIELD: 13826
 box.error.ER_TUPLE_IS_RO: 1025
 box.error.ER_ARG_TYPE: 10498
 box.error.ER_NO_SUCH_SPACE: 14594
-box.error.ER_TUPLE_IS_EMPTY: 6402
+box.error.ER_SPACE_DISABLED: 13314
 box.error.ER_PROC_LUA: 13058
 box.error.ER_NO_SUCH_PROC: 12802
-box.error.ER_UNKNOWN_UPDATE_OP: 11266
+box.error.ER_SPLICE: 10754
 box.error.ER_KEY_PART_COUNT: 12034
-box.error.ER_FIELD_TYPE: 10242
 box.error.ER_WAL_IO: 9986
+box.error.ER_FIELD_TYPE: 10242
 box.error.ER_MEMORY_ISSUE: 1793
 ...
diff --git a/test/lib/sql_ast.py b/test/lib/sql_ast.py
index 1d828a7320..6bf6e9f599 100644
--- a/test/lib/sql_ast.py
+++ b/test/lib/sql_ast.py
@@ -50,7 +50,7 @@ ER = {
    22: "ER_RESERVED22"          ,
    23: "ER_RESERVED23"          ,
    24: "ER_UNUSED24"            ,
-   25: "ER_TUPLE_IS_EMPTY"      ,
+   25: "ER_UNUSED25"            ,
    26: "ER_FIBER_STACK"         ,
    27: "ER_UNUSED27"            ,
    28: "ER_UNUSED28"            ,
-- 
GitLab