From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 900A543040C for ; Fri, 14 Aug 2020 18:04:56 +0300 (MSK) From: imeevma@tarantool.org Date: Fri, 14 Aug 2020 18:04:55 +0300 Message-Id: <804a579f9ba60138c0bf579da4c6a3c253d2c272.1597417321.git.imeevma@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 02/10] sql: fix functions return types List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org 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