@@ -163,6 +163,8 @@ insert t1 (x) values (2) on duplicate key update x= 3, row_end= '1970-01-01 00:0
163
163
ERROR 42S22: Unknown column 'row_end' in 'field list'
164
164
insert t2 (y) values (1) on duplicate key update y= 3, row_end= '1970-01-01 00:00:00';
165
165
ERROR HY000: The value specified for generated column 'row_end' in table 't2' has been ignored
166
+ insert t2 (y,row_end) values (1, '1970-01-01 00:00:00') on duplicate key update y= 3;
167
+ ERROR HY000: The value specified for generated column 'row_end' in table 't2' has been ignored
166
168
insert into t1 values (4);
167
169
insert into t1 set x= 5, row_start= '1980-01-01 00:00:00', row_end= '1980-01-01 00:00:01';
168
170
insert into t1(x, row_start, row_end) values (6, '1980-01-01 00:00:01', '1980-01-01 00:00:00');
@@ -231,36 +233,13 @@ ERROR 42S22: Unknown column 'row_start' in 'field list'
231
233
replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1;
232
234
ERROR 42S22: Unknown column 'row_start' in 'field list'
233
235
set @@system_versioning_insert_history= 1;
236
+ # REPLACE ignores system_versioning_insert_history
234
237
replace into t2 (a, row_end) values (0, '1980-01-01 00:00:00');
235
- ERROR HY000: Incorrect row_start value: 'now'
236
- replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1980-01-01 00:00:01');
237
- select a, row_start, row_end from t2 for system_time all order by a, row_start, row_end;
238
- a row_start row_end
239
- 1 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
240
- # Changing row_end via REPLACE is NOT possible, we just insert new row:
241
- replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1990-01-01 00:00:01');
242
- select a, row_start, row_end from t2 for system_time all order by a, row_start, row_end;
243
- a row_start row_end
244
- 1 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
245
- 1 1980-01-01 00:00:00.000000 1990-01-01 00:00:01.000000
246
- # REPLACE is DELETE + INSERT
247
- set timestamp=unix_timestamp('2020-10-10 10:10:10');
248
- replace into t2 (a, row_start, row_end) values (1, '1971-01-01 00:00:00', '1980-01-01 00:00:01');
249
- set timestamp=default;
250
- select a, row_start, row_end from t2 for system_time all order by a, row_start, row_end;
251
- a row_start row_end
252
- 1 1971-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
253
- 1 1980-01-01 00:00:00.000000 1990-01-01 00:00:01.000000
254
- 1 1980-01-01 00:00:00.000000 2020-10-10 10:10:10.000000
255
- replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1 for system_time all
256
- where x > 1 and row_end < TIMESTAMP'2038-01-19 03:14:07.999999';
257
- select a, row_start, row_end from t2 for system_time all order by a, row_start, row_end;
258
- a row_start row_end
259
- 1 1971-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
260
- 1 1980-01-01 00:00:00.000000 1990-01-01 00:00:01.000000
261
- 1 1980-01-01 00:00:00.000000 2020-10-10 10:10:10.000000
262
- 3 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
263
- 5 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000
238
+ ERROR 42S22: Unknown column 'row_end' in 'field list'
239
+ replace into t3 (z, row_start) values (0, '1980-01-01 00:00:00');
240
+ ERROR HY000: The value specified for generated column 'row_start' in table 't3' has been ignored
241
+ replace into t3 values (0, '1980-01-01 00:00:00', '1981-01-01 00:00:00');
242
+ ERROR HY000: The value specified for generated column 'row_start' in table 't3' has been ignored
264
243
# LOAD DATA
265
244
select x, row_start, row_end into outfile 'DATAFILE' from t1 for system_time all;
266
245
create or replace table t2 like t1;
0 commit comments