Skip to content

Commit bc97057

Browse files
committed
MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
exclude generated columns from the "has default value" check
1 parent adbad5e commit bc97057

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

mysql-test/main/long_unique_bugs.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,5 +448,11 @@ a b
448448
1 xxx
449449
drop table t1;
450450
#
451+
# MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
452+
#
453+
create table t1 (f text not null, unique (f));
454+
insert into t1 (f) select 'f';
455+
drop table t1;
456+
#
451457
# End of 10.4 tests
452458
#

mysql-test/main/long_unique_bugs.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,13 @@ insert into t1 (a,b) select 1,'xxx' from seq_1_to_5;
442442
select * from t1;
443443
drop table t1;
444444

445+
--echo #
446+
--echo # MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
447+
--echo #
448+
create table t1 (f text not null, unique (f));
449+
insert into t1 (f) select 'f';
450+
drop table t1;
451+
445452
--echo #
446453
--echo # End of 10.4 tests
447454
--echo #

sql/sql_insert.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, TABLE_LIST *t
21342134
for (Field **field=entry->field ; *field ; field++)
21352135
{
21362136
if (!bitmap_is_set(write_set, (*field)->field_index) &&
2137-
!(*field)->vers_sys_field() &&
2137+
!(*field)->vers_sys_field() && !(*field)->vcol_info &&
21382138
has_no_default_value(thd, *field, table_list) &&
21392139
((*field)->real_type() != MYSQL_TYPE_ENUM))
21402140
err=1;

0 commit comments

Comments
 (0)