[Tarantool-patches] [PATCH v2 02/10] sql: fix functions return types

imeevma at tarantool.org imeevma at tarantool.org
Fri Aug 14 18:04:55 MSK 2020


This patch fixes incorrect return types in SQL built-in function definitions.
---
 src/box/sql/func.c    | 10 +++++-----
 test/sql/types.result |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 487cdafe1..affb285aa 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -2466,7 +2466,7 @@ static struct {
 	}, {
 	 .name = "IFNULL",
 	 .param_count = 2,
-	 .returns = FIELD_TYPE_INTEGER,
+	 .returns = FIELD_TYPE_SCALAR,
 	 .aggregate = FUNC_AGGREGATE_NONE,
 	 .is_deterministic = true,
 	 .flags = SQL_FUNC_COALESCE,
@@ -2516,7 +2516,7 @@ static struct {
 	}, {
 	 .name = "LIKE",
 	 .param_count = -1,
-	 .returns = FIELD_TYPE_INTEGER,
+	 .returns = FIELD_TYPE_BOOLEAN,
 	 .aggregate = FUNC_AGGREGATE_NONE,
 	 .is_deterministic = true,
 	 .flags = SQL_FUNC_NEEDCOLL | SQL_FUNC_LIKE,
@@ -2526,7 +2526,7 @@ static struct {
 	}, {
 	 .name = "LIKELIHOOD",
 	 .param_count = 2,
-	 .returns = FIELD_TYPE_BOOLEAN,
+	 .returns = FIELD_TYPE_SCALAR,
 	 .aggregate = FUNC_AGGREGATE_NONE,
 	 .is_deterministic = true,
 	 .flags = SQL_FUNC_UNLIKELY,
@@ -2536,7 +2536,7 @@ static struct {
 	}, {
 	 .name = "LIKELY",
 	 .param_count = 1,
-	 .returns = FIELD_TYPE_BOOLEAN,
+	 .returns = FIELD_TYPE_SCALAR,
 	 .aggregate = FUNC_AGGREGATE_NONE,
 	 .is_deterministic = true,
 	 .flags = SQL_FUNC_UNLIKELY,
@@ -2686,7 +2686,7 @@ static struct {
 	}, {
 	 .name = "ROUND",
 	 .param_count = -1,
-	 .returns = FIELD_TYPE_INTEGER,
+	 .returns = FIELD_TYPE_DOUBLE,
 	 .aggregate = FUNC_AGGREGATE_NONE,
 	 .is_deterministic = true,
 	 .flags = 0,
diff --git a/test/sql/types.result b/test/sql/types.result
index 95f7713e8..2498f3a48 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -231,7 +231,7 @@ box.execute("SELECT s LIKE NULL FROM t1;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: integer
+    type: boolean
   rows:
   - [null]
 ...
@@ -257,7 +257,7 @@ box.execute("SELECT NULL LIKE s FROM t1;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: integer
+    type: boolean
   rows:
   - [null]
 ...
-- 
2.25.1



More information about the Tarantool-patches mailing list