[tarantool-patches] Re: [PATCH v1 1/1] sql: assertion in autoincrement column

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Oct 10 13:21:53 MSK 2018

Hi! Thanks for the fixes! See 3 comments below.

>> 3. Why mismatch? integer * integer * integer is still an
>> integer. If it is an overflow, then it should print 'overflow',
>> it is not? An overflow should be detected somewhere.
> Now it is works the same way it works with columns without
> autoincrement:
> create table t4 (s1 int primary key);
> insert into t4 values (2147483647);
> insert into t4 select max(s1)*max(s1)*max(s1) from t4;
> Also, result of query
> select max(s1)*max(s1)*max(s1) from t4
> is a real number:
> 9.903520300448e+27

1. The thing you said does not correlate with my
question. Why mismatch? I multiplied integer three
times, it should not auto turn into double then. It
should throw 'overflow' error.

> New patch:
> commit 53a229c67b096a09f26df4b5ba73d9a90c46e38f
> Author: Mergen Imeev <imeevma at gmail.com>
> Date:   Thu Sep 27 22:42:29 2018 +0300
>      sql: assertion in autoincrement column
>      If query is like "INSERT INTO table SELECT ..." then it is
>      completely fine that the result of SELECT isn't integer. This
>      value wasn't cheched propertly if it was inserted in column
>      with autoincrement.

2. As you said above, it is not about autoincrement. Why in the
commit message do you say on the contrary?

3. It is not linked with "insert into table select". This fails
as well:

box.sql.execute("CREATE TABLE t0 (s1 INT PRIMARY KEY)")
box.sql.execute("INSERT INTO t0 VALUES (2147483647*2147483647*2147483647)")

>      Closes #3670

More information about the Tarantool-patches mailing list