Closed
Description
It seems that prepared statements are necessary for test of select statements with 'FOR SYSTEM_TIME', since mysql-test doesn't allow statements that change for every test.
Sequence of commands that cause segfault of MariaDB server:
drop table t1;drop table T1;CREATE TABLE t1 (x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;CREATE TABLE T1 (x INT UNSIGNED, y INT UNSIGNED);insert into t1(x, y) values(1, 11),(2,12),(3,13),(4,14),(5,15);insert into T1(x, y) values(1, 11),(2,12),(3,13),(4,14),(5,15);SELECT * FROM t1;SELECT * FROM T1;prepare stmtT1 from 'select x, y from T1';execute stmtT1;prepare stmtt1 from 'select x, y from t1';execute stmtt1;
> CREATE TABLE t1 (x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;
Query OK, 0 rows affected (0.02 sec)
> CREATE TABLE T1 (x INT UNSIGNED, y INT UNSIGNED)
Query OK, 0 rows affected (0.01 sec)
> insert into t1(x, y) values(1, 11),(2,12),(3,13),(4,14),(5,15);
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
> insert into T1(x, y) values(1, 11),(2,12),(3,13),(4,14),(5,15);
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
> SELECT * FROM t1;
+------+------+----------------------------+----------------------------+
| x | y | Sys_start | Sys_end |
+------+------+----------------------------+----------------------------+
| 1 | 11 | 2016-09-06 09:14:35.992804 | 2038-01-19 04:14:07.000000 |
| 2 | 12 | 2016-09-06 09:14:35.992804 | 2038-01-19 04:14:07.000000 |
| 3 | 13 | 2016-09-06 09:14:35.992804 | 2038-01-19 04:14:07.000000 |
| 4 | 14 | 2016-09-06 09:14:35.992804 | 2038-01-19 04:14:07.000000 |
| 5 | 15 | 2016-09-06 09:14:35.992804 | 2038-01-19 04:14:07.000000 |
+------+------+----------------------------+----------------------------+
5 rows in set (0.00 sec)
> SELECT * FROM T1;
+------+------+
| x | y |
+------+------+
| 1 | 11 |
| 2 | 12 |
| 3 | 13 |
| 4 | 14 |
| 5 | 15 |
+------+------+
5 rows in set (0.00 sec)
> prepare stmtT1 from 'select x, y from T1';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
> execute stmtT1;
+------+------+
| x | y |
+------+------+
| 1 | 11 |
| 2 | 12 |
| 3 | 13 |
| 4 | 14 |
| 5 | 15 |
+------+------+
5 rows in set (0.00 sec)
> prepare stmtt1 from 'select x, y from t1';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
> execute stmtt1;
ERROR 2013 (HY000): Lost connection to MySQL server during query