[tarantool-patches] Re: [PATCH 3/3] sql: fix passing FP values to integer iterator
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue May 28 00:49:18 MSK 2019
On 25/05/2019 08:51, Konstantin Osipov wrote:
> * Nikita Pettik <korablev at tarantool.org> [19/05/24 20:42]:
>> That happened due to the fact that type casting mechanism (OP_ApplyType)
>> doesn't affect FP value when it is converted to integer. Hence, FP value
>> was passed to the iterator over integer field which resulted in error.
>> Meanwhile, comparison of integer and FP values is legal in SQL. To cope
>> with this problem for each equality comparison involving integer field
>> we emit OP_MustBeInt, which checks whether value to be compared is
>> integer or not. If the latter, we assume that result of comparison is
>> always false and continue processing query.
>
> Are you sure other vendords would fail to return any results for
> WHERE foo = 1.0?
I do not understand, what you are talking about. It works.
tarantool> box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT UNIQUE);")
---
- row_count: 1
...
tarantool> box.execute("INSERT INTO t1 VALUES (1, 1);")
---
- row_count: 1
...
tarantool> box.execute("SELECT a FROM t1 WHERE a = 1.0;")
---
- metadata:
- name: A
type: integer
rows:
- [1]
...
More information about the Tarantool-patches
mailing list