[Tarantool-patches] [PATCH v1 2/7] sql: do not return UNSIGNED in built-in functions
imeevma at tarantool.org
imeevma at tarantool.org
Wed Aug 12 18:15:47 MSK 2020
This patch forces functions to return INTEGER instead of UNSIGNED.
Part of #4159
---
src/box/sql/vdbeapi.c | 2 +-
test/sql/types.result | 12 ++++++++++++
test/sql/types.test.lua | 6 ++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index 7c59ef83f..d1eeaf114 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -328,7 +328,7 @@ sql_result_double(sql_context * pCtx, double rVal)
void
sql_result_uint(sql_context *ctx, uint64_t u_val)
{
- mem_set_u64(ctx->pOut, u_val);
+ mem_set_int(ctx->pOut, u_val, false);
}
void
diff --git a/test/sql/types.result b/test/sql/types.result
index 442245186..95f7713e8 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -2795,3 +2795,15 @@ box.execute([[DROP TABLE ts;]])
---
- row_count: 1
...
+--
+-- gh-4159: Make sure that functions returns values of type INTEGER
+-- instead of values of type UNSIGNED.
+--
+box.execute([[SELECT typeof(length('abc'));]])
+---
+- metadata:
+ - name: COLUMN_1
+ type: string
+ rows:
+ - ['integer']
+...
diff --git a/test/sql/types.test.lua b/test/sql/types.test.lua
index 0270d9f8a..fff0057bd 100644
--- a/test/sql/types.test.lua
+++ b/test/sql/types.test.lua
@@ -623,3 +623,9 @@ box.execute([[DROP TABLE tb;]])
box.execute([[DROP TABLE tt;]])
box.execute([[DROP TABLE tv;]])
box.execute([[DROP TABLE ts;]])
+
+--
+-- gh-4159: Make sure that functions returns values of type INTEGER
+-- instead of values of type UNSIGNED.
+--
+box.execute([[SELECT typeof(length('abc'));]])
--
2.25.1
More information about the Tarantool-patches
mailing list