From: imeevma@tarantool.org To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v1 2/7] sql: do not return UNSIGNED in built-in functions Date: Wed, 12 Aug 2020 18:15:47 +0300 [thread overview] Message-ID: <3d38cd163a24bf14298a16ee7231086a4df56015.1597244875.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1597244875.git.imeevma@gmail.com> 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
next prev parent reply other threads:[~2020-08-12 15:15 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-12 15:15 [Tarantool-patches] [PATCH v1 0/7] sql: properly check arguments types of " imeevma 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 1/7] box: add has_vararg option for functions imeevma 2020-08-12 15:15 ` imeevma [this message] 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 3/7] sql: move built-in function definitions in _func imeevma 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 4/7] box: add param_list to 'struct func' imeevma 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 5/7] sql: check built-in functions argument types imeevma 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 6/7] sql: VARBINARY and STRING in built-in functions imeevma 2020-08-12 15:15 ` [Tarantool-patches] [PATCH v1 7/7] sql: refactor sql/func.c imeevma
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3d38cd163a24bf14298a16ee7231086a4df56015.1597244875.git.imeevma@gmail.com \ --to=imeevma@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 2/7] sql: do not return UNSIGNED in built-in functions' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox