From 212c57421bd20478cedf4e07ad01bca21815265a Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Sat, 13 Jul 2019 00:49:49 +0300
Subject: [PATCH] func: consolidate func_def checks in func_def_chekc

A follow up on #4182
---
 src/box/func.c     | 6 ------
 src/box/func_def.c | 8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/box/func.c b/src/box/func.c
index 637eeecfec..5528f176dd 100644
--- a/src/box/func.c
+++ b/src/box/func.c
@@ -389,12 +389,6 @@ struct func *
 func_sql_builtin_new(struct func_def *def)
 {
 	assert(def->language == FUNC_LANGUAGE_SQL_BUILTIN);
-	if (def->body != NULL || def->is_sandboxed) {
-		diag_set(ClientError, ER_CREATE_FUNCTION, def->name,
-			 "body and is_sandboxed options are not compatible "
-			 "with SQL language");
-		return NULL;
-	}
 	struct func *func =
 		(struct func *) malloc(sizeof(*func));
 	if (func == NULL) {
diff --git a/src/box/func_def.c b/src/box/func_def.c
index 09b3cbf999..41bef2ac75 100644
--- a/src/box/func_def.c
+++ b/src/box/func_def.c
@@ -99,6 +99,14 @@ func_def_check(struct func_def *def)
 			return -1;
 		}
 		break;
+	case FUNC_LANGUAGE_SQL_BUILTIN:
+		if (def->body != NULL || def->is_sandboxed) {
+			diag_set(ClientError, ER_CREATE_FUNCTION, def->name,
+				 "body and is_sandboxed options are not compatible "
+				 "with SQL language");
+			return -1;
+		}
+		break;
 	default:
 		break;
 	}
-- 
GitLab