Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 2/2] sql: disallow explicit cast of VARBINARY to number
Date: Mon, 26 Jul 2021 22:12:56 +0200	[thread overview]
Message-ID: <01e68660-cc8e-158b-dd9d-36643ece89db@tarantool.org> (raw)
In-Reply-To: <d9b817112899bc87dbf2676c10cffe3ba9c9481a.1626880058.git.imeevma@gmail.com>

Thanks for the patch!

See 3 comments below.

On 21.07.2021 17:10, Mergen Imeev via Tarantool-patches wrote:
> This patch removes explicit cast of VARBINARY values to numeric types.
> 
> Part of #4470
> Closes #4772
> Closes #5852

1. You might need to add a changelog file.

> diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> index 3dc49c38e..379fbf09e 100755
> --- a/test/sql-tap/cast.test.lua
> +++ b/test/sql-tap/cast.test.lua
> @@ -867,13 +879,14 @@ test:do_test(
>  -- gh-4356: Check that result of blob to number cast if of type
>  -- number.

2. This comment could mean the test becomes just wrong and can
be deleted.

> diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
> index 56b11da25..a2877167f 100755
> --- a/test/sql-tap/numcast.test.lua
> +++ b/test/sql-tap/numcast.test.lua
> @@ -149,20 +149,22 @@ test:do_execsql_test(
>  -- gh-4233: Make sure that NUMBER can contain UNSIGNED, INTEGER
>  -- and DOUBLE and is not automatically converted to DOUBLE.
>  --

3. These tests seem to be quite far from this comment. Perhaps they
are broken for some time already. Might worth deleting them.

> -test:do_execsql_test(
> +test:do_catchsql_test(
>      "numcast-3.1",
>      [[
>          SELECT CAST(x'3131313131313131313131313131313131313131' AS NUMBER);
>      ]], {
> -        11111111111111111111ULL
> +        1, "Type mismatch: can not convert "..
> +           "varbinary(x'3131313131313131313131313131313131313131') to number"
>      })
>  
> -test:do_execsql_test(
> +test:do_catchsql_test(
>      "numcast-3.2",
>      [[
>          SELECT CAST(x'31313131313131313131313131313131313131312E' AS NUMBER);
>      ]], {
> -        11111111111111110656
> +        1, "Type mismatch: can not convert "..
> +           "varbinary(x'31313131313131313131313131313131313131312E') to number"
>      })
>  
>  test:do_execsql_test(
> 

      reply	other threads:[~2021-07-26 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 15:10 [Tarantool-patches] [PATCH v1 0/2] Fix explicit casts Mergen Imeev via Tarantool-patches
2021-07-21 15:10 ` [Tarantool-patches] [PATCH v1 1/2] sql: disallow explicit cast of BOOLEAN to number Mergen Imeev via Tarantool-patches
2021-07-26 20:11   ` Vladislav Shpilevoy via Tarantool-patches
2021-07-21 15:10 ` [Tarantool-patches] [PATCH v1 2/2] sql: disallow explicit cast of VARBINARY " Mergen Imeev via Tarantool-patches
2021-07-26 20:12   ` Vladislav Shpilevoy via Tarantool-patches [this message]

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=01e68660-cc8e-158b-dd9d-36643ece89db@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 2/2] sql: disallow explicit cast of VARBINARY to number' \
    /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