[Tarantool-patches] [PATCH v1 1/1] sql: remove OP_Realify
Kirill Yukhin
kyukhin at tarantool.org
Wed Aug 4 17:08:43 MSK 2021
Hello,
On 04 авг 11:30, imeevma at tarantool.org wrote:
> This opcode was used to convert INTEGER values to REAL. It is not
> necessary in Tarantool and causes errors.
>
> Due to OP_Realify two type of errors appeared:
> 1) In some cases in trigger INTEGER may be converted to DOUBLE.
> For example:
> box.execute("CREATE TABLE t (i NUMBER PRIMARY KEY, n NUMBER);")
> box.execute("CREATE TRIGGER t AFTER INSERT ON t FOR EACH ROW BEGIN UPDATE t SET n = new.n; END;")
> box.execute("INSERT INTO t VALUES (1, 1);")
> box.execute("SELECT i / 2, n / 2 FROM t;")
>
> Result:
> tarantool> box.execute("SELECT i / 2, n / 2 FROM t;")
> ---
> - metadata:
> - name: COLUMN_1
> type: number
> - name: COLUMN_2
> type: number
> rows:
> - [0, 0.5]
> ...
>
> 2) If SELECT uses GROUP BY then it may return DOUBLE instead of INTEGER.
> For example:
> box.execute("CREATE TABLE t (i NUMBER PRIMARY KEY, n NUMBER);")
> box.execute("INSERT INTO t VALUES (1,1);")
> box.execute("SELECT i / 2, n / 2 FROM t GROUP BY n;")
>
> Result:
> tarantool> box.execute("SELECT i / 2, n / 2 FROM t GROUP BY n;")
> ---
> - metadata:
> - name: COLUMN_1
> type: number
> - name: COLUMN_2
> type: number
> rows:
> - [0.5, 0.5]
> ...
>
> This patch removes OP_Realify, after which these errors disappear.
>
> Closes #5335
> ---
> https://github.com/tarantool/tarantool/issues/5335
> https://github.com/tarantool/tarantool/tree/imeevma/gh-5335-remove-op-realify
The patch LGTM.
--
Regards, Kirill Yukhin
More information about the Tarantool-patches
mailing list