Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v4 2/3] sql: fix implicit cast from STRING to INTEGER
Date: Fri, 27 Mar 2020 16:54:17 +0000	[thread overview]
Message-ID: <20200327165417.GD9287@tarantool.org> (raw)
In-Reply-To: <bed63c7b293d04ba706f102ec4e3af2411f0ec70.1585308644.git.imeevma@gmail.com>

On 27 Mar 14:33, imeevma@tarantool.org wrote:
> Prior to this patch, STRING, which contains the DOUBLE value,
> could be implicitly cast to INTEGER. This was done by converting
> STRING to DOUBLE and then converting this DOUBLE value to INTEGER.
> This may affect the accuracy of CAST(), so it was forbidden.
> 
> Example:
> box.execute("CREATE TABLE t(i INT PRIMARY KEY);")
> 
> Before patch:
> box.execute("INSERT INTO t VALUES ('111.1');")
> box.execute("SELECT * FROM t;")
> Result: 111
> 
> After patch:
> box.execute("INSERT INTO t VALUES ('1.1');")
> Result: 'Type mismatch: can not convert 1.1 to integer'
> 
> box.execute("INSERT INTO t VALUES ('1.0');")
> Result: 'Type mismatch: can not convert 1.0 to integer'
> 
> box.execute("INSERT INTO t VALUES ('1.');")
> Result: 'Type mismatch: can not convert 1. to integer'

Is comparison predicat affected?

> Part of #4766
> 
> @TarantoolBot document
> Title: disallow cast from STRING contais DOUBLE to INTEGER

-> contains
 
> diff --git a/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua b/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua
> index 0865c4e..559e33d 100755
> --- a/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua
> +++ b/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua

Same nit concerning test file as in previous patch: personally I'd
not introduce it.

  reply	other threads:[~2020-03-27 16:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 11:33 [Tarantool-patches] [PATCH v4 0/3] sql: fix CAST() from BLOB " imeevma
2020-03-27 11:33 ` [Tarantool-patches] [PATCH v4 1/3] sql: fix CAST() from STRING " imeevma
2020-03-27 16:46   ` Nikita Pettik
2020-04-10 10:39     ` Mergen Imeev
2020-04-10 10:43       ` Mergen Imeev
2020-04-10 13:05         ` Nikita Pettik
2020-04-10 17:06           ` Imeev Mergen
2020-04-15 11:13             ` Nikita Pettik
2020-04-10 12:46       ` Nikita Pettik
2020-04-10 13:05         ` Imeev Mergen
2020-03-27 11:33 ` [Tarantool-patches] [PATCH v4 2/3] sql: fix implicit cast " imeevma
2020-03-27 16:54   ` Nikita Pettik [this message]
2020-04-10 10:41     ` Mergen Imeev
2020-04-10 12:57       ` Nikita Pettik
2020-04-10 18:09         ` Mergen Imeev
2020-03-27 11:33 ` [Tarantool-patches] [PATCH v4 3/3] sql: add '\0' to the BLOB when it is cast " imeevma
2020-03-27 16:54   ` Nikita Pettik
2020-04-16  0:03 ` [Tarantool-patches] [PATCH v4 0/3] sql: fix CAST() from BLOB " Nikita Pettik

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=20200327165417.GD9287@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 2/3] sql: fix implicit cast from STRING to INTEGER' \
    /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