From: Peter Gulutzan <pgulutzan@ocelot.ca> To: Konstantin Osipov <kostja.osipov@gmail.com>, Imeev Mergen <imeevma@tarantool.org> Cc: tarantool-discussions@dev.tarantool.org Subject: Re: [Tarantool-discussions] Implicit cast for ASSIGNMENT Date: Thu, 30 Apr 2020 08:15:52 -0600 [thread overview] Message-ID: <a2d05765-7869-440b-2548-17e4bc9cc465@ocelot.ca> (raw) In-Reply-To: <20200430140414.GD6499@atlas> Hi, On 2020-04-30 8:04 a.m., Konstantin Osipov wrote: > * Imeev Mergen <imeevma@tarantool.org> [20/04/30 16:14]: >> >> On 4/30/20 4:09 PM, Konstantin Osipov wrote: >>> * Imeev Mergen <imeevma@tarantool.org> [20/04/30 15:59]: >>>>> The only possible exception is conversion of a lossless conversion >>>>> of a numeric literal, e.g.: >>>>> >>>>> float_val = 1.1 -- implicitly convert decimal constant 1.1 to float >>>> So, is it fine to implicitly cast 1.0(DOUBLE) to 1(INTEGER)? >>> 1.0 is not double, it's DECIMAL. >> Ok, then, let's say we executed something like this: >> >> box.execute('CREATE TABLE t (i INT PRIMARY KEY);') >> box.execute('INSERT INTO t VALUES(CAST(1 AS DOUBLE));') >> >> Should this work of we should receive an error? > > I think it shouldn't because CAST(1 AS DOUBLE) is an expression, > not a constant literal. > I of course think that it should work, but K. Yukhin decided it should not work. With regard to the earlier questions Unfortunately assigning 1.1 to an INTEGER fails. "Implicit casting among the numeric data types" is a mandatory feature of standard SQL, My opinion was that implicit cast should be legal https://github.com/tarantool/tarantool/issues/4216 However, K. Yukhin closed that issue. I also believed that typeof(1.0) should be DECIMAL. https://github.com/tarantool/tarantool/issues/4415 But currently typeof(1.0) is DOUBLE. Peter Gulutzan
next prev parent reply other threads:[~2020-04-30 14:15 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 [this message] 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 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=a2d05765-7869-440b-2548-17e4bc9cc465@ocelot.ca \ --to=pgulutzan@ocelot.ca \ --cc=imeevma@tarantool.org \ --cc=kostja.osipov@gmail.com \ --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