mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-14631 Assertion `!sys_trx_start && !sys_trx_end' failed in crete_tmp_table
SQL: remove unneeded assertion SQL: disallow set sys_trx fields in INSERT ... SELECT Fixes by @midenok.
This commit is contained in:
committed by
Aleksey Midenkov
parent
c66a20b494
commit
717f274b87
@ -301,6 +301,13 @@ select *, sys_trx_end = 18446744073709551615 as current from t1 for system_time
|
|||||||
x y current
|
x y current
|
||||||
2 2 1
|
2 2 1
|
||||||
1 1 0
|
1 1 0
|
||||||
|
create or replace table t1 (i int) with system versioning engine innodb;
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
insert into t1 (sys_trx_start) select sys_trx_end from t1;
|
||||||
|
ERROR HY000: Column 'sys_trx_start' is not updatable
|
||||||
|
insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, 1);
|
||||||
|
ERROR HY000: Column 'sys_trx_end' is not updatable
|
||||||
|
insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, DEFAULT);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop table t2;
|
drop table t2;
|
||||||
drop procedure test_01;
|
drop procedure test_01;
|
||||||
|
@ -17,59 +17,59 @@ a b b+0
|
|||||||
1 NULL NULL
|
1 NULL NULL
|
||||||
3 NULL NULL
|
3 NULL NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t for system_time as of timestamp now(6);
|
select * from t for system_time as of timestamp now(6);
|
||||||
a b
|
a b
|
||||||
1 NULL
|
1 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select count(*) from t group by b for system_time as of timestamp now(6);
|
select count(*) from t group by b for system_time as of timestamp now(6);
|
||||||
count(*)
|
count(*)
|
||||||
2
|
2
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t for system_time as of timestamp now(6) order by b asc;
|
select * from t for system_time as of timestamp now(6) order by b asc;
|
||||||
a b
|
a b
|
||||||
1 NULL
|
1 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t for system_time as of timestamp now(6) order by b desc;
|
select * from t for system_time as of timestamp now(6) order by b desc;
|
||||||
a b
|
a b
|
||||||
1 NULL
|
1 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t group by a having a=2 for system_time as of timestamp now(6);
|
select * from t group by a having a=2 for system_time as of timestamp now(6);
|
||||||
a b
|
a b
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t group by b having b=2 for system_time as of timestamp now(6);
|
select * from t group by b having b=2 for system_time as of timestamp now(6);
|
||||||
a b
|
a b
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t where b=2 for system_time as of timestamp now(6);
|
select a from t where b=2 for system_time as of timestamp now(6);
|
||||||
a
|
a
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t where b=NULL for system_time as of timestamp now(6);
|
select a from t where b=NULL for system_time as of timestamp now(6);
|
||||||
a
|
a
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t where b is NULL for system_time as of timestamp now(6);
|
select a from t where b is NULL for system_time as of timestamp now(6);
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
3
|
3
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
|
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
|
||||||
count(*) b
|
count(*) b
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a, b from t;
|
select a, b from t;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
@ -78,29 +78,29 @@ select count(*) from t for system_time as of timestamp now(6) group by b;
|
|||||||
count(*)
|
count(*)
|
||||||
2
|
2
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t for system_time as of timestamp now(6) group by b having b=2;
|
select * from t for system_time as of timestamp now(6) group by b having b=2;
|
||||||
a b
|
a b
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t for system_time as of timestamp now(6) where b=2;
|
select a from t for system_time as of timestamp now(6) where b=2;
|
||||||
a
|
a
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t for system_time as of timestamp now(6) where b=NULL;
|
select a from t for system_time as of timestamp now(6) where b=NULL;
|
||||||
a
|
a
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select a from t for system_time as of timestamp now(6) where b is NULL;
|
select a from t for system_time as of timestamp now(6) where b is NULL;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
3
|
3
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
|
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
|
||||||
count(*) b
|
count(*) b
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
create or replace table t (
|
create or replace table t (
|
||||||
a int,
|
a int,
|
||||||
b int not null without system versioning
|
b int not null without system versioning
|
||||||
@ -111,12 +111,12 @@ a b
|
|||||||
1 NULL
|
1 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
select * from t for system_time as of timestamp now(6) where b is NULL;
|
select * from t for system_time as of timestamp now(6) where b is NULL;
|
||||||
a b
|
a b
|
||||||
1 NULL
|
1 NULL
|
||||||
3 NULL
|
3 NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
Warning 4112 Attempt to read unversioned field `b` in historical query
|
Warning 4111 Attempt to read unversioned field `b` in historical query
|
||||||
drop table t;
|
drop table t;
|
||||||
|
@ -72,7 +72,7 @@ ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERS
|
|||||||
alter table t1 add partition (
|
alter table t1 add partition (
|
||||||
partition p1 versioning);
|
partition p1 versioning);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4115 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions.
|
Warning 4114 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions.
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
@ -209,7 +209,7 @@ x
|
|||||||
2
|
2
|
||||||
delete from t1;
|
delete from t1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4116 Switching from partition `p0` to `p1`
|
Note 4115 Switching from partition `p0` to `p1`
|
||||||
select * from t1 partition (p0) for system_time all;
|
select * from t1 partition (p0) for system_time all;
|
||||||
x
|
x
|
||||||
1
|
1
|
||||||
@ -219,7 +219,7 @@ x
|
|||||||
insert into t1 values (3);
|
insert into t1 values (3);
|
||||||
delete from t1;
|
delete from t1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 4114 Using full partition `p1`, need more VERSIONING partitions!
|
Warning 4113 Using full partition `p1`, need more VERSIONING partitions!
|
||||||
select * from t1 partition (p1) for system_time all;
|
select * from t1 partition (p1) for system_time all;
|
||||||
x
|
x
|
||||||
2
|
2
|
||||||
@ -252,7 +252,7 @@ x
|
|||||||
insert into t1 values (4);
|
insert into t1 values (4);
|
||||||
delete from t1;
|
delete from t1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4116 Switching from partition `p0` to `p1`
|
Note 4115 Switching from partition `p0` to `p1`
|
||||||
select * from t1 partition (p1) for system_time all;
|
select * from t1 partition (p1) for system_time all;
|
||||||
x
|
x
|
||||||
4
|
4
|
||||||
@ -274,8 +274,8 @@ x
|
|||||||
2
|
2
|
||||||
delete from t1;
|
delete from t1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 4116 Switching from partition `p0` to `p1`
|
Note 4115 Switching from partition `p0` to `p1`
|
||||||
Warning 4114 Using full partition `p1`, need more VERSIONING partitions!
|
Warning 4113 Using full partition `p1`, need more VERSIONING partitions!
|
||||||
select * from t1 partition (p0sp0) for system_time all;
|
select * from t1 partition (p0sp0) for system_time all;
|
||||||
x
|
x
|
||||||
1
|
1
|
||||||
|
@ -203,6 +203,14 @@ insert into t1 values (1, null);
|
|||||||
update t1 set x= x + 1;
|
update t1 set x= x + 1;
|
||||||
select *, sys_trx_end = 18446744073709551615 as current from t1 for system_time all;
|
select *, sys_trx_end = 18446744073709551615 as current from t1 for system_time all;
|
||||||
|
|
||||||
|
create or replace table t1 (i int) with system versioning engine innodb;
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
--error ER_NONUPDATEABLE_COLUMN
|
||||||
|
insert into t1 (sys_trx_start) select sys_trx_end from t1;
|
||||||
|
--error ER_NONUPDATEABLE_COLUMN
|
||||||
|
insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, 1);
|
||||||
|
insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, DEFAULT);
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop table t2;
|
drop table t2;
|
||||||
|
|
||||||
|
@ -7815,9 +7815,6 @@ ER_INVALID_VALUE_TO_LIMIT
|
|||||||
ER_VERSIONING_REQUIRED
|
ER_VERSIONING_REQUIRED
|
||||||
eng "System Versioning required: %s"
|
eng "System Versioning required: %s"
|
||||||
|
|
||||||
ER_VERS_READONLY_FIELD
|
|
||||||
eng "System field %`s is read-only"
|
|
||||||
|
|
||||||
ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING
|
ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING
|
||||||
eng "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld"
|
eng "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld"
|
||||||
|
|
||||||
|
@ -8067,12 +8067,11 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
|
|||||||
ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
|
ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
|
||||||
rfield->field_name.str, table->s->table_name.str);
|
rfield->field_name.str, table->s->table_name.str);
|
||||||
}
|
}
|
||||||
if (table->versioned() && rfield->vers_sys_field() &&
|
if (table->versioned() && rfield->vers_sys_field())
|
||||||
!ignore_errors)
|
|
||||||
{
|
{
|
||||||
if (type == Item::DEFAULT_VALUE_ITEM)
|
if (type == Item::DEFAULT_VALUE_ITEM)
|
||||||
continue;
|
continue;
|
||||||
my_error(ER_VERS_READONLY_FIELD, MYF(0), rfield->field_name.str);
|
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), rfield->field_name.str);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8308,7 +8307,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
|
|||||||
|
|
||||||
if (table->versioned() && field->vers_sys_field() && !ignore_errors)
|
if (table->versioned() && field->vers_sys_field() && !ignore_errors)
|
||||||
{
|
{
|
||||||
my_error(ER_VERS_READONLY_FIELD, MYF(0), field->field_name.str);
|
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), field->field_name.str);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17632,10 +17632,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
|||||||
share->row_start_field= sys_trx_start->field_index;
|
share->row_start_field= sys_trx_start->field_index;
|
||||||
share->row_end_field= sys_trx_end->field_index;
|
share->row_end_field= sys_trx_end->field_index;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(!sys_trx_start && !sys_trx_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUG_ASSERT(fieldnr == (uint) (reg_field - table->field));
|
DBUG_ASSERT(fieldnr == (uint) (reg_field - table->field));
|
||||||
DBUG_ASSERT(field_count >= (uint) (reg_field - table->field));
|
DBUG_ASSERT(field_count >= (uint) (reg_field - table->field));
|
||||||
|
Reference in New Issue
Block a user