From: Peter Gulutzan <pgulutzan@ocelot.ca>
To: Imeev Mergen <imeevma@tarantool.org>
Cc: tarantool-discussions@dev.tarantool.org
Subject: Re: [Tarantool-discussions] Implicit cast for ASSIGNMENT
Date: Thu, 7 May 2020 10:14:10 -0600 [thread overview]
Message-ID: <a41c1c2d-b9dc-5f81-40ef-d40fabd80041@ocelot.ca> (raw)
In-Reply-To: <3baee836-8404-bfaf-1c3a-353a379861d0@ocelot.ca>
Hi,
Re this part of your proposal:
>> 3) Values of numeric types can be implicitly cast to other numeric
Earlier I replied:
>I believe this but K. Yukhin decided to close issue#4216.
Update: K. Yukhin has re-opened
issue#4216 Silent NUMBER cast to INTEGER
https://github.com/tarantool/tarantool/issues/4216
and K. Osipov wrote:
> OK, I didn't know it's ANSI. I withdraw my previous remarks and
> side with Peter. Please do as he says about implicit casts of
> numeric types.
Therefore I believe that everyone agrees with you,
"Values of numeric types can be implicitly cast to other numeric"
for assignments.
Therefore ...
This will be true for anything that has a numeric data type,
now or in the planned future
(DECIMAL, DOUBLE, INTEGER, NUMBER, UNSIGNED).
Maybe this will be true for STRING.
UPDATE table_name SET integer_column = '1.1';
I said that is bad but I don't decide.
Maybe this will be true for SCALAR.
You announced that you will "fix" so values have type = SCALAR.
I do not know why, I do not know how, so I say "maybe".
You said there will be truncation not rounding. So:
CREATE TABLE t (s1 DOUBLE PRIMARY KEY, s2 INTEGER);
INSERT INTO t VALUES (1.9, NULL);
UPDATE t SET s2 = s1;
will cause no error and no warning, s2 will contain 1.
Documentation changes:
Fortunately in the compliance chart I wrote
https://www.tarantool.io/en/doc/2.4/book/sql/
that we support standard core feature E011-06
"Implicit casting among the numeric data types"
so that does not need to be changed.
Unfortunately in the SQL reference I wrote:
https://www.tarantool.io/en/doc/2.4/reference/reference_sql/sql/
"From number to INTEGER or UNSIGNED is allowed for
cast and assignment only if the result is not out of range,
and the number has no post-decimal digits."
so that does need to be changed.
Peter Gulutzan
next prev parent reply other threads:[~2020-05-07 16:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 14:25 Mergen Imeev
2020-02-13 14:40 ` Konstantin Osipov
2020-02-13 22:20 ` Peter Gulutzan
2020-04-30 12:04 ` Imeev Mergen
2020-04-30 12:35 ` Konstantin Osipov
2020-04-30 12:56 ` Imeev Mergen
2020-04-30 13:09 ` Konstantin Osipov
2020-04-30 13:12 ` Imeev Mergen
2020-04-30 14:04 ` Konstantin Osipov
2020-04-30 14:15 ` Peter Gulutzan
2020-04-30 14:28 ` Konstantin Osipov
2020-04-30 14:40 ` Peter Gulutzan
2020-04-30 15:10 ` Imeev Mergen
2020-04-30 16:04 ` Peter Gulutzan
2020-05-07 16:14 ` Peter Gulutzan [this message]
2020-05-08 11:57 ` Kirill Yukhin
2020-04-30 22:52 ` [Tarantool-discussions] Descriptive SQL Style Guide Peter Gulutzan
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=a41c1c2d-b9dc-5f81-40ef-d40fabd80041@ocelot.ca \
--to=pgulutzan@ocelot.ca \
--cc=imeevma@tarantool.org \
--cc=tarantool-discussions@dev.tarantool.org \
--subject='Re: [Tarantool-discussions] Implicit cast for ASSIGNMENT' \
/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