Commit c274853c authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-25638 Assertion `!result' failed in convert_const_to_int

When fixing vcols, fix_fields might call convert_const_to_int().
And that will try to read the field value (from record[0]).
Mark the table as having no data to prevent that, because record[0]
is not initialized yet.
parent 4681b6f2
......@@ -236,6 +236,37 @@ insert t1 (b) values (1);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
#
# MDEV-25638 Assertion `!result' failed in convert_const_to_int
#
create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select v1 from t1;
v1
select * from t1;
v1
prepare stmt from "select * from t1";
execute stmt;
v1
execute stmt;
v1
flush tables;
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x111'
select * from t1;
v1
deallocate prepare stmt;
drop table t1;
#
# MDEV-26061 MariaDB server crash at Field::set_default
#
create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
......
......@@ -177,6 +177,25 @@ select * from t1 where a is null;
insert t1 (b) values (1);
drop table t1;
--echo #
--echo # MDEV-25638 Assertion `!result' failed in convert_const_to_int
--echo #
--enable_prepare_warnings
create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
select * from t1;
select v1 from t1;
select * from t1;
prepare stmt from "select * from t1";
execute stmt;
execute stmt;
flush tables;
select * from t1;
select * from t1;
deallocate prepare stmt;
drop table t1;
--disable_prepare_warnings
--echo #
--echo # MDEV-26061 MariaDB server crash at Field::set_default
--echo #
......
......@@ -3093,6 +3093,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->s= share;
outparam->db_stat= db_stat;
outparam->write_row_record= NULL;
outparam->status= STATUS_NO_RECORD;
if (share->incompatible_version &&
!(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment