From 6f707430e5e24aed3720e39de6cf49dc8d18d131 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 9 Jan 2021 18:48:16 +0100 Subject: cleanup: copy RAII helpers from 10.5, cleanup test --- sql/unireg.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sql/unireg.cc') diff --git a/sql/unireg.cc b/sql/unireg.cc index 92949931f77..9c22527581a 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -944,7 +944,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, TABLE table; TABLE_SHARE share; Create_field *field; - enum_check_fields old_count_cuted_fields= thd->count_cuted_fields; + Check_level_instant_set old_count_cuted_fields(thd, CHECK_FIELD_WARN); DBUG_ENTER("make_empty_rec"); /* We need a table to generate columns for default values */ @@ -963,7 +963,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, null_pos= buff; List_iterator it(create_fields); - thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values while ((field=it++)) { /* regfield don't have to be deleted as it's allocated on THD::mem_root */ @@ -1039,6 +1038,5 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, *(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1); err: - thd->count_cuted_fields= old_count_cuted_fields; DBUG_RETURN(error); } /* make_empty_rec */ -- cgit v1.2.1 From 0d8bd7cc3ac9b71450f47700320dfd3d67347a88 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 10 Jan 2021 00:57:02 +0100 Subject: MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE * be strict in CREATE TABLE, just like in ALTER TABLE, because CREATE TABLE, just like ALTER TABLE, can be rolled back for any engine * but don't auto-convert warnings into errors for engine warnings (handler::create) - this matches ALTER TABLE behavior * and not when creating a default record, these errors are handled specially (and replaced with ER_INVALID_DEFAULT) * always issue a Note when a non-unique key is truncated, because it's not a Warning that can be converted to an Error. Before this commit it was a Note for blobs and a Warning for all other data types. --- sql/unireg.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/unireg.cc') diff --git a/sql/unireg.cc b/sql/unireg.cc index 9c22527581a..7974255af35 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -945,6 +945,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, TABLE_SHARE share; Create_field *field; Check_level_instant_set old_count_cuted_fields(thd, CHECK_FIELD_WARN); + Abort_on_warning_instant_set old_abort_on_warning(thd, 0); DBUG_ENTER("make_empty_rec"); /* We need a table to generate columns for default values */ -- cgit v1.2.1 From ef5adf520760536c7396bdfe884fc509ac065694 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 4 Feb 2021 16:06:54 +0100 Subject: MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error partially revert 76063c2a13. Item::clone() is not an all-purpose Item copying machine, it was specifically created for pushdown of predicates into derived tables and views and it does not copy everything. In particular, it does not copy Item_func_regex. Fix the bug differently by preserving the old constraint name. But keep setting automatic_name=true to have it regenerated for cases like ALTER TABLE ... ADD CONSTRAINT. --- sql/unireg.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'sql/unireg.cc') diff --git a/sql/unireg.cc b/sql/unireg.cc index 17222efe791..8e432c54b15 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -57,13 +57,7 @@ static bool make_empty_rec(THD *, uchar *, uint, List &, uint, */ static uchar *extra2_write_len(uchar *pos, size_t len) { - /* TODO: should be - if (len > 0 && len <= 255) - *pos++= (uchar)len; - ... - because extra2_read_len() uses 0 for 2-byte lengths. - extra2_str_size() must be fixed too. - */ + DBUG_ASSERT(len); if (len <= 255) *pos++= (uchar)len; else -- cgit v1.2.1